0% found this document useful (0 votes)
4 views

Club Robotics

La fich du club

Uploaded by

Zineb Zero
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Club Robotics

La fich du club

Uploaded by

Zineb Zero
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

// C++ code

//

#include <Adafruit_LiquidCrystal.h>

int seconds = 0;

Adafruit_LiquidCrystal lcd(0);

void setup()

Serial.begin(9600);

lcd.begin(16, 2);

lcd.print("Entrez texte:");

void loop()

if (Serial.available() > 0) {

lcd.clear();

lcd.setCursor(0, 0);

String message = Serial.readString();

lcd.print(message);

}
2.

Code Arduino 1

#include <Wire.h>

const int ledPin = 13;

void setup() {

Wire.begin(8);

Wire.onReceive(receiveEvent);

pinMode(ledPin, OUTPUT);

void loop() {

void receiveEvent(int bytes) {

int state = Wire.read();

digitalWrite(ledPin, state == 1 ? HIGH : LOW);

Code Arduino 2
#include <Wire.h>

const int buttonPin = 3;

int buttonState = 0;

void setup() {

Wire.begin();

pinMode(buttonPin, INPUT_PULLUP);

void loop() {

buttonState = digitalRead(buttonPin);

Wire.beginTransmission(8);

Wire.write(buttonState == LOW ? 1 : 0);

Wire.endTransmission();

delay(100);

You might also like