1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#include <Eeprom24Cxx.h>
#include <Wire.h>
#define ledRed A0
#define ledGreen A1
#define ledBlue A3
static Eeprom24C eeprom(4, 0x50);
int i =0;
long valueCounterAll= 0;
void setup()
{
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledBlue, OUTPUT);
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, LOW);
digitalWrite(ledBlue, LOW);
Serial.begin(9600);
}
void loop()
{
if (Serial.available())
{
i = Serial.parseInt();
byte data = eeprom.read_1_byte(i);
for (int i = 0; i < 8; i++)
{
Serial.print(bitRead(data, 7 - i));
}
Serial.println("");
}
if(valueCounterAll>=10000000)
{
digitalWrite(ledRed, HIGH);
digitalWrite(ledGreen, LOW);
digitalWrite(ledBlue, HIGH);
}
else if (valueCounterAll<10000000)
{
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, HIGH);
digitalWrite(ledBlue, HIGH);
}
else
{
digitalWrite(ledRed, HIGH);
digitalWrite(ledGreen, HIGH);
digitalWrite(ledBlue, LOW);
}
}
|