This code repository was created in order to store examples of the blink program for Arduino and ESP8266 devices to make sure the hardware is working.
It contains a makefile for using arduino-mk to flash an Arduino Nano from a command line prompt. There are other projects for using makefiles with ESP8266 devices.
This code is the same as the default Arduino blink code, but updates with a better delay along with different defines dependiing on if using an Arduino or ESP8266. The included makefile contains code to launch stty, which is a command line based serial communication software.
The serial_blink contains code to test receiving text from a serial console and blinks every second to show that the code is currently running. The included makefile also contains code to launch the GUI based serial communication software moserial.
//Blink - turns on LED on Arduino, modified Arduino's Blink.ino
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
#define LED 13
volatile bool led_state = 0;
String str;
volatile uint16_t loopNum = 0;
void toggleLED(){
led_state = !led_state;
digitalWrite(LED, led_state);
}
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
// initialize the digital pin as an output.
pinMode(LED, OUTPUT);
Serial.write("Startup\n");
}
// the loop routine runs over and over again forever:
void loop() {
Serial.print("L"); Serial.print(loopNum); Serial.print("\n");
loopNum++;
toggleLED();
if (Serial.available()>0){
str = Serial.readStringUntil('\n');
Serial.print("rcv: ");
Serial.print(str);
}
delay(1000); // wait for a second
}