Tuesday, September 28, 2010

Scrolling text on a sparkfun 7 segment serial display with Arduino

Here is a youtube video showing scrolling text on a sparkfun 7 segment serial display.

http://www.youtube.com/watch?v=WFEq9U17cKk

Here is the arduino code.

/*Scrolling text on a sparkfun 7 segment serial display.

My code is based in part on the code in the tutorial at

http://www.arunet.co.uk/tkboyd/ec/ec1led4x7ser.htm

If you are new to this display, I suggest checking out the tutorial first.
Once you have played around with displaying text, then try my code.

The tutorial didn't specify a license for the code. Given the spirit of the Arduino
I will assume it's public domain.

My code is copyright under the Gnu General Public Licence (GLP) version 3 or any later version
The text of the GPL can be found at http://www.gnu.org/licenses/gpl.html

Many thanks to TK Boyd for creating the tutorial above.



The RX pin on the display is hooked up to digital pin 3 on the arduino. The wiper on the potentiometer is hooked up to analog pin 0 on the arduino.

This code requires the newsoftserial library. If you don't have it installed, do so.

*/



#include <NewSoftSerial.h> //Make sure you have this library installed,

#define SerInToArdu 2 // input pin to arduino. Not used in this example
#define SerOutFrmArdu 3 // output pin from arduino




NewSoftSerial mySerialPort(SerInToArdu,SerOutFrmArdu); /* creates a serial channel to send the data to and from the display. */

char text[] = " HELLO TO YOU ALL IN YOUTUBE LAND "; /* Array with our text. Blank spaces are so characters start from the right and disappear off the left side There should be 3 blank spaces in the beginning of the array text and 4 blank spaces at the end. Blogger is being stupid and only showing one blank space.*/



void setup() {
pinMode(SerOutFrmArdu,OUTPUT); //sets pin to output
pinMode(SerInToArdu,INPUT); /* Not actually needed... put in to be explicit as to data direction over serial lines */

mySerialPort.begin(9600);

mySerialPort.print("v"); /* a special code to reset the display. See tutorial above for more info on special codes */

}

void loop() {
mySerialPort.print("v"); //rest display
for (int num = 0; num <= sizeof(text) - 5; num++) { /* simple for loop. sizeof function checks size of array. Avoids having to hard code array size. The arduino laguage reference used a -1 in their example. I ended up having to use a -5 to get it to work right. Not sure exactly how it works, but it does. See arduino language reference for more info on sizeof() */


mySerialPort.print(text[num]); /* send character in array index num, to display */
mySerialPort.print(text[num+1]);/* send next character in array after index num */
mySerialPort.print(text[num+2]);/* send third character in array after index num */
mySerialPort.print(text[num+3]); /* send fourth character in array after index num */

/*In first time through loop. above code would send the contents of array indexes 0123.
Second time in loop it would send contents of indexes 1234. And so on.
The text is shifted one space each time through the loop. 4 characters are send to the display each time

Here is what it looks like. X is a blank space
1st time through loop XXXH
2nd XXHE
3rd XHEL
4th HELL
5th ELLO
6th LLOX
7th LOXT
8th OXTO
ETC ETC
*/


delay(analogRead(0)); /* delay by pot value. This controls the speed the text scrolls at */

}
delay(500); //Short pause after text is done scrolling

Saturday, September 25, 2010

Arduino and sparkfun 7 segment display

Here is a simple demo I made of an arduino and sparkfun 7 segment display.

http://www.youtube.com/watch?v=dLDefQAYy4s

Here is the code for it



/* Arduino and sparkfun 7 segment display. http://www.sparkfun.com/commerce/product_info.php?products_id=9765

Counts up to 5000 and back down to 0. Speed of counting is adjustable by a potentiometer.

My code is based off the code from this tutorial
http://www.arunet.co.uk/tkboyd/ec/ec1led4x7ser.htm

A big thanks to the person that wrote that tutorial.

You will need to install the newsoftserial library for this code to work.

Wiring is simple.

Digital pin 3 on arduino to RX on display.
Ground pin on arduino to GND on display.
5 volt pin on arduino to VCC on display

The pot is hooked up to analog input pin 0. If you don't know how to hook up a pot. Look for videos on youtube.
*/


#include //Make sure you have this library installed,

#define SerInToArdu 2 // input pin to arduino. Not used in this example
#define SerOutFrmArdu 3 // output pin from arduino




NewSoftSerial mySerialPort(SerInToArdu,SerOutFrmArdu); //creates a serial //channel to send the data to and from the display.


void setup(){

pinMode(SerOutFrmArdu,OUTPUT); //sets pin to output
pinMode(SerInToArdu,INPUT);//Not actually needed... put in to be explicit as to //data direction over serial lines

mySerialPort.begin(9600);

/* send a "v" to the display. It's a special code to reset the display. See tutorial above for more info on special codes */
mySerialPort.print("v");

}

void loop(){

for (int num = 0; num <= 5000; num++) { //simple for loop

/*reset display. Makes numbers show up better. Try it without the reset to see what it looks like*/
mySerialPort.print("v");
mySerialPort.print(num); //send value of num to display
delay(analogRead(0)); //delay by pot value
}

//same as above except for loop goes in pposite direction
for (int num = 5000; num >= 0; num--) {
mySerialPort.print("v");
mySerialPort.print(num);
delay(analogRead(0));
}

}

Tuesday, December 9, 2008

The paradox of existence

A friend of mine pointed me to this post by Amanda Baggs. Her post got me thinking about how we can exist and not exist, for the very same reasons.

As a kid I was taken to white coats of various stripes to try to figure out what was wrong with me. At the time the diagnosis of Asperger's wasn't available. So the doctors didn't have a convenient label to explain my behaviors and things. The best the doctors could tell my parents was that I wasn't normal, but I wasn't abnormal. So to the doctors, I didn't exist.

In school those very same behaviors led to me being the target of bulling. “Hey look it's the stupid fat kid. Everyone grab your torches and pitchforks.” So in a twisted sort of way, I existed. Although I existed as the kid to be picked on and made fun of. Perhaps school would have gone more smoothly had I not existed.

As an adult, if people want to know about my disability and how it affects me, I exist. If I express my opinions on cures and treatments I don't exist because I don't have “real autism”.

If there is profit to be made, we exist. As long as we are lining the pockets of the doctors and pharmaceutical companies, we exist. If my parents are shelling out $100 an hour to my therapist, I exist.

When we cost money, we don't exist. When I applied for SSDI I was denied because I wasn't disabled prior to the age of 22. Even though I am on SSI for Asperger's, which you can't get as an adult.

So we can both exist and not exit, for the very same reasons.

Thursday, October 9, 2008

Autism conspiracy theories...some people have their foil hat on a bit to tight

As I was poking around the net I ran across this blog by Fore Sam entitled Hating Autism. This guy is something else. He is a firm believer in the idea that mercury causes autism. I understand that many people believe that, so I can excuse that to some degree. But this guy takes that far off into conspiracy theory land.

He seems to think that mercury was introduced as a vaccine preservative in order to dumb down the American people. He doesn't end there. He also thinks there is a neurdiversity conspiracy out there. He also is a firm believer that Amanda Baggs is a fraud working on behalf of "Neurodiversity"(note capital N) and the drug companies. What makes me scratch my head is how Amanda's message benefits drug companies. Drug companies don't want people to be told that their kids are fine the way they are, just different. No, they want people to get the message that their kids are broken and they have just the thing to fix them.

This guy also thinks that any autistic person who refuses a cure is insane. In a comment on one of his blog entries he says "There aren't any sane autistic people who disagree with me. The sane ones want to be cured." Then I guess this makes a certified whack job because I don't want a cure.

I swear some people have their foil hat on a little to tight.

Tuesday, September 2, 2008

Assistive tech update

So I finally got around to learning some python not to long ago. My python skills are still pretty basic. Hopefully I can get good enough with it to crank out some text to speech software for autistics. The software will probably end up being open source.

On the hardware side of things. Once I can afford it, I want to get an Asus EEE PC. Those are small enough that they might make good text to speech devices. Also, the newest flavor can apparently run for 5 to 7 hours. The other thing I want to look at is a PDA that can run linux. That would be sweet. Although a small laptop would be more convenient for entering text. Inputting text on my Palm PDA is a bit of a pain.

Thats about it. I will keep you updated.

Monday, September 1, 2008

It's that time of the year folks. It's "lets pity those poor unfortunate cripple kids day".....err the Jerry Lewis MDA telethon. So get get out your credit cards to help pay the high priced salaries of the executives at the MDA.... I mean, those poor children suffering from muscular dystrophy. Seriously though. The MDA, their telethon and Jerry Lewis can all burn in hell. For years disability activists have been complaining about how the telethon is demeaning to people with disabilities. I personally haven't ever seen an MDA telethon. But, I plan on watching it this year. I will probably write a blog about it.

Thursday, August 7, 2008

Update on assistive tech for autism

Recently I switched to using Linux. I currently use OpenSuse Linux, I am also going to be installing Ubuntu Linux on my laptop. So I am looking at linux that as the basis for assistive tech software for autistics. It's free (as in freedom) and many distributions are available at no cost. The XO laptop seems like a good platform for assistive tech for autistics (particularly kids). Unfortunately my programming skills are not very good. I plan on playing around with the python programming language. My first project will probably be some text to speech software for autistics. It will run on linux using the festival text to speech engine. Once I get something done with that, I will post an update here.