I took my test code from my previous PI post and made a few changes to make things easier to read and use. This tutorial shows the functions, how to use them, and then demonstrates how to add functions to BASH memory so that they can be called quickly and easily without clogging up your scripts. Continue reading
Reading and Writing to the RasPi GPIO using BASH
I’ve finally taken some time to play with my Pi after getting some of the peripherals to work. I struggled getting the sound to work, but finally found a post that described what to do. I’d like to point out that I’m still using Debian Squeeze. That might be where some of my issues stem from.
Raspberrypi.org has the latest downloads, and many of the bugs that I deal with are probably solved by now in newer distributions.
What I have done is taken the time to play with the GPIO port using a Bash script. My Bash skills are not top notch, but with a little searching I can usually get things done. Here’s what I discovered using my simple Bash script. Continue reading
I wrote a program after all. After looking through a couple of cards, I realized that it might take forever to decode them by hand. I spent a few hours writing four programs in C++. I’ve only tried these in Windows, but I’m sure that they can also be compiled nicely in Linux.
I am going to try my best to explain this. You’ll need to download the zipped files here–>StripeSnoopDecoder.zip
I used Dev-C++ to compile mine. Either that for Windows (or any other compiler) or g++ (or the like) for Linux.
I keep my Omron reader head in the top position (track 3). Most cards that I have do not use track three, so I must use a shim to get to track one. The shim is about 0.265″. To read track two I use a 0.135″ shim. Track three just slides through as normal. You also need to make sure that you slide your card through the reader in the correct direction. My program will not work backwards.
- Step 1: Swipe the card using Stripe Snoop’s raw mode. Now look for the first ’1′. If the first 5 bits are ’11010′, use the 5-bit ascii file folder. (Most of my first tracks were five bits, but if you have ’1010001′ you’ll need to use the 7-bit ascii file folder.) Most of the cards that I have swiped used odd-parity ascii with either five or seven bits. Five bits are usually used for numbers only while seven bits contain messages. With a little practice you’ll be able to figure out which one it is, and you’ll also be able to use this to know if your data is legit.
I was messing around with a parallel LCD earlier, and I could not figure out how to display variables to it. I was becoming agitated when an idea came to mind. When I programmed clocks, I remember breaking the time down into four segments. The same thing applies here. Bingo. Below is my test code in C++ to emulate C. The only difference is the integers on a computer are 4 BYTES in length. In the test code for a negative numbers in a microcontroller, there will need to be an overloaded function to send signed integers to since an unsigned integer might be misinterpreted as signed. There will be more challenges ahead. There will need to be other approaches for floating numbers.
There is no error checking in the code below. Be sure that you do not exceed the length of the character array. They will always need one more place to account for the null character.
I have been working on an infrared remote for a couple of weeks, and I decided I wanted to write a program for a Microchip that would accomplish the task. I started writing a C program to do the heavy lifting and a thought came to mind. I will have no way of controlling the actual timing of the circuit using C. I might get close, but the code could be way off.
I continued to write some stuff in C, but it wound up being mostly Assembly. Then I just went and finished writing another copy completely in Assembly. I used MPLAB to configure the fuses. Configure…Configuration Bits…