Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- const int tlacitko1 = 2;
- const int tlacitko2 = 3;
- int stavTlacitka1;
- int stavTlacitka2;
- void setup()
- {
- Serial.begin(9600);
- Wire.begin();
- pinMode(tlacitko1, INPUT);
- pinMode(tlacitko2, INPUT);
- }
- void loop()
- {
- stavTlacitka1 = digitalRead(tlacitko1);
- stavTlacitka2 = digitalRead(tlacitko2);
- if (stavTlacitka1 == HIGH) {
- Wire.beginTransmission(1);
- delay(100);
- Wire.write('a');
- delay(100);
- Wire.endTransmission();
- Serial.print("Tlacitko1 = ");
- Serial.print(stavTlacitka1);
- Serial.println(" =>");
- delay(100);
- }
- else if (stavTlacitka2 == HIGH) {
- Wire.beginTransmission(1);
- delay(100);
- Wire.write('b');
- delay(100);
- Wire.endTransmission();
- Serial.print("Tlacitko2 = ");
- Serial.print(stavTlacitka2);
- Serial.println(" =>");
- delay(100);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement