Im running into some problems trying to write a program which takes accelerometer data and makes LEDs light up. There are 3 LED's, 1,2,3, and when the accelerometer gives a certain value, say 5, no LED's should come on, If the value is less than 5 the 1st led should light up. Then when the acceleromter goes back to its reference point, 5 in this case, no LED is on. When the value is greater than 5 the 3rd LED should turn on. Any suggestions how to start a C++ code to do this?
Thank you. But how do you get tell the program to light a LED like the first light or third light. Do you have to write a command in the beginning to tell it so? Im sorry, im just really bad at programming and i am trying to teach myself and learn.
You could display the values of LED1, LED2 and LED3 to the console, save it in a file, etc...
To turn an actual physical LED on and off requires that you are programming a microcontroller of some kind.
The timing on this thread is amazing. I just got my Arduino UNO 4 days ago and have been tinkering with it furiously ever since!
The command to turn an LED on or off in a program for the arduino would be: digitalWrite( 2, HIGH );// turn the LED connected to output pin 2 ON
or digitalWrite( 2, LOW );// turn the LED connected to output pin 2 OFF
Yes I am using a micro controller also. The micro controller has to be programmed in C++. It's similar to the arduino UNO. I'm still trying to tinker with it. Thanks for the help guys. Every little bit is a ton of help for me.
It's more of a new company I'm guessing. A knock off arduino. Most of their documentation is in German or something. I've downloaded te software and everything so I can compile and upload code to the board.