NEED HELP..
ihave arduino mega.5led.1button.and txt file
"seq.txt"on my sdcard.
iwant to control sequence of led on using txt file..how code for it..great hopefull please.thamk you.
Txt file content is 1.2.3.4.5.
Star led no1 on..press button.led 1 off..led2 on..press button..led2of..led3on..until led 5 and loop back to led 1 continuesly.
if txt file change..1.4.2.1.5...
Ita mean sequence.is led1.led4.led2.led1.led5 back to led1...
Hello
Describe the desired functionality in simple words, and quite simply.
Hello,
show your sketch do you have already designed.
NEED HELP
i have mega.5led.1button and txt file.."seq.txt"on my sdcard.
iwant to control sequence of led on using txt file..how code for it..great hopefull please.thamk you.
Txt file content is 1.2.3.4.5.
Star led no1 on..press button.led 1 off..led2 on..press button..led2of..led3on..until led 5 and loop back to led 1 continuesly.
if txt file change..1.4.2.1.5...
Ita mean sequence.is led1.led4.led2.led1.led5 back to led1...
Read your text char by char building up a string until you reach a period.
Using atoi(); get the value of that string to set your LED.
Then go grab more chars.
Repeat 'till you run out of text.
Easy peasy, get busy.
-jim lee
Yes, this is possible.
Begin with one of the example sketches from the SD card library. Change it to read from the file and print to serial monitor. Then you can check it is working.
Next, change it to flash your LEDs.
Some hints:
You can use the .parseInt() function to read a number from the file.
Put the pin numbers for your LEDs into an array so that you can write
digitalWrite(led[n],HIGH);
Thank Jim but i am newbie..so no basic experience..can you give me some script abou that..thank a lot beforr
Paul thank alot..please sent script if you get ...thank you..
If you try, I will help. If you do not try, I will not help.
TOPIC MERGED.
Could you take a few moments to Learn How To Use The Forum.
Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum.
Code can i try below:withoit txt file
open seq.txt on sdcard
int led1 = 3;
int led2 = 5;
int led3 = 6;
int led4 = 9;
int led5 = 10;
const int but1 = 13;
int but1s; int a = HIGH;
int b = LOW;
long time = 0;
long debounce = 200;
void setup() { // put your setup code here, to run once:
pinMode (led1, OUTPUT);
pinMode (led2, OUTPUT);
pinMode (led3, OUTPUT);
pinMode (led4, OUTPUT);
pinMode (led5, OUTPUT);
pinMode (led6, OUTPUT);
pinMode (but1, INPUT); }
void loop() { // put your main code here, to run repeatedly:
but1s = digitalRead(but1);
if (but1s == HIGH && b == LOW && millis() - time > debounce) { if (a == HIGH) { a = LOW; }
else { a = HIGH; } time = millis(); }
digitalWrite(led1, a); delay (50);
digitalWrite(led2, a); delay (50);
digitalWrite(led3, a); delay (50);
digitalWrite(led4, a); delay (50);
digitalWrite(led5, a); delay (50);
digitalWrite(led6, a); delay (50);
b = but1s; }
actually can not open txt on sd card....
Follow my advice from reply #7
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.