43 #define SERIAL_BAUD 115200
47 #ifdef __AVR_ATmega1284P__
48 #define LED 15 // Moteino MEGAs have LEDs on D15
49 #define FLASH_SS 23 // and FLASH SS on D23
51 #define LED 9 // Moteinos have LEDs on D9
52 #define FLASH_SS 8 // and FLASH SS on D8
65 Serial.begin(SERIAL_BAUD);
66 Serial.print(
"Start...");
69 Serial.println(
"Init OK!");
72 Serial.println(
"Init FAIL!");
82 if (Serial.available() > 0) {
83 input = Serial.read();
85 Serial.println(
"Flash content:");
89 Serial.print(flash.
readByte(counter++), HEX);
94 }
else if (input ==
'e') {
95 Serial.print(
"Erasing Flash chip ... ");
98 Serial.println(
"DONE");
99 }
else if (input ==
'i') {
100 Serial.print(
"DeviceID: ");
102 }
else if (input >= 48 && input <= 57) {
103 Serial.print(
"\nWriteByte(");
106 flash.
writeByte(input-48, (millis()%2) ? 0xaa : 0xbb);
111 if ((
int)(millis()/500) > lastPeriod) {
113 pinMode(LED, OUTPUT);
114 digitalWrite(LED, lastPeriod%2);
118 void Blink(
byte PIN,
int DELAY_MS,
byte loops)
120 pinMode(PIN, OUTPUT);
122 digitalWrite(PIN,
HIGH);
124 digitalWrite(PIN,
LOW);