I have some weird s**t going on. I have a core currently plugged into a relay board fed from a 12V 5A power supply
Firstly, the spark core will not program more than once without manually entering bootloader mode. It has been doing this all day, from the demo led flasher to something slightly more complex.
Next, the following knuckle-dragging code resets the board at the end of the loop. This is evidenced by the main led flashing green, then flashing cyan, then breathing cyan. Also the setup code runs. This happens at the end of every loop.
If I change the rly_on_time to be 100, the program runs a lot quicker, but runs without problems. Also the core can be remotely programmed without forcing bootloader mode.
The latest is the board has difficulty entering bootloader or factory reset modes. Currently the web IDE gives me an error 400 when i try to flash the device.
Thoughts?
// A short routine to walk through the relay board
int pin_rly1 = D0;
int pin_rly2 = D1;
int pin_rly3 = D2;
int pin_rly4 = D3;
int Led_out = D7;
int rly_on_time = 1500;
void setup() {
pinMode(pin_rly1, OUTPUT);
pinMode(pin_rly2, OUTPUT);
pinMode(pin_rly3, OUTPUT);
pinMode(pin_rly4, OUTPUT);
pinMode(Led_out, OUTPUT);
// signify the program has booted - light the blue led
digitalWrite(Led_out, HIGH);
delay(900);
digitalWrite(Led_out, LOW);
}
void loop() {
for (int i = 0; i < 5; i ++)
// we are going to walk through the relays 5 times
{
digitalWrite(pin_rly1, HIGH);
delay(rly_on_time);
digitalWrite(pin_rly1, LOW);
digitalWrite(pin_rly2, HIGH);
delay(rly_on_time);
digitalWrite(pin_rly2, LOW);
digitalWrite(pin_rly3, HIGH);
delay(rly_on_time);
digitalWrite(pin_rly3, LOW);
digitalWrite(pin_rly4, HIGH);
delay(rly_on_time);
digitalWrite(pin_rly4, LOW);
}
digitalWrite(Led_out, HIGH);
delay(900);
digitalWrite(Led_out, LOW);
}