comptrondu
comptrondu
int LED_Rouge=13;
void setup() {
pinMode(LED_Rouge, OUTPUT);
void loop() {
digitalWrite(LED_Rouge, HIGH);
delay(1000);
digitalWrite(LED_Rouge, LOW);
delay(1000);
//tp1app2
int LED_Rouge=13;
int LED_Orange=12;
int LED_Vert=11;
void setup() {
pinMode(LED_Rouge,OUTPUT);
pinMode(LED_Orange,OUTPUT);
pinMode(LED_Vert,OUTPUT);
void loop() {
digitalWrite(LED_Rouge, HIGH);
delay(4000);
digitalWrite(LED_Rouge, LOW);
digitalWrite(LED_Orange, HIGH);
delay(1000);
digitalWrite(LED_Orange, LOW);
digitalWrite(LED_Vert, HIGH);
delay(4000);
digitalWrite(LED_Vert, LOW);
//tp1app3
int LED_Rouge=13;
int Button=1;
void setup() {
pinMode(LED_Rouge,OUTPUT);
pinMode(Button,INPUT);
void loop() {
if(digitalRead(Button)==HIGH){
digitalWrite(LED_Rouge,HIGH);
else{
digitalWrite(LED_Rouge,LOW);
//tp1app4
int LED_Rouge=12;
int Button1=1;
int Button2=2;
void setup() {
pinMode(LED_Rouge,OUTPUT);
pinMode(Button1,INPUT);
pinMode(Button2,INPUT);
void loop() {
if(digitalRead(Button1)==HIGH){
digitalWrite(LED_Rouge,HIGH);
if(digitalRead(Button2)==HIGH){
digitalWrite(LED_Rouge,LOW);
//tp3app1
// a, b, c, d, e, f, g
{1, 1, 1, 1, 1, 1, 0}, // 0
{0, 1, 1, 0, 0, 0, 0}, // 1
{1, 1, 0, 1, 1, 0, 1}, // 2
{1, 1, 1, 1, 0, 0, 1}, // 3
{0, 1, 1, 0, 0, 1, 1}, // 4
{1, 0, 1, 1, 0, 1, 1}, // 5
{1, 0, 1, 1, 1, 1, 1}, // 6
{1, 1, 1, 0, 0, 0, 0}, // 7
{1, 1, 1, 1, 1, 1, 1}, // 8
{1, 1, 1, 1, 0, 1, 1} // 9
};
void setup() {
pinMode(segmentPins[i], OUTPUT);
void loop() {
displayDigit(i);
digitalWrite(segmentPins[i], digits[num][i]);
//tp3app2
const int a = 8;
const int b = 7;
const int c = 6;
const int d = 5;
const int e = 4;
const int f = 3;
const int g = 2;
int digits[10][7] = {
{1, 1, 1, 1, 1, 1, 0}, // 0
{0, 1, 1, 0, 0, 0, 0}, // 1
{1, 1, 0, 1, 1, 0, 1}, // 2
{1, 1, 1, 1, 0, 0, 1}, // 3
{0, 1, 1, 0, 0, 1, 1}, // 4
{1, 0, 1, 1, 0, 1, 1}, // 5
{1, 0, 1, 1, 1, 1, 1}, // 6
{1, 1, 1, 0, 0, 0, 0}, // 7
{1, 1, 1, 1, 1, 1, 1}, // 8
{1, 1, 1, 1, 0, 1, 1} // 9
};
int currentDigit = 0;
void setup() {
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);
pinMode(e, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
pinMode(buttonPin, INPUT);
displayDigit(currentDigit);
void loop() {
displayDigit(currentDigit);
lastButtonState = buttonState;
digitalWrite(a, digits[digit][0]);
digitalWrite(b, digits[digit][1]);
digitalWrite(c, digits[digit][2]);
digitalWrite(d, digits[digit][3]);
digitalWrite(e, digits[digit][4]);
digitalWrite(f, digits[digit][5]);
digitalWrite(g, digits[digit][6]);
//tp4app1
The circuit:
* 10K resistor:
#include <LiquidCrystal.h>
lcd.begin(16, 2);
lcd.print("hello, world!");
void loop() {
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
lcd.print(millis() / 1000);
//tp4app2
#include <LiquidCrystal.h>
void setup() {
lcd.begin(16, 2);
// Print a message to the LCD.
void loop() {
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(4,0);
lcd.print("BIENVENUE");
lcd.setCursor(6,1);
lcd.print("ISET M");
//tp4app3
The circuit:
* 10K resistor:
#include <LiquidCrystal.h>
void setup() {
lcd.begin(16, 2);
lcd.print("hello, world!");
delay(1000);
void loop() {
lcd.scrollDisplayLeft();
// wait a bit:
delay(150);
lcd.scrollDisplayRight();
// wait a bit:
delay(150);
}
lcd.scrollDisplayLeft();
// wait a bit:
delay(150);
delay(1000);
//tp4app4
#include <LiquidCrystal.h>
void setup() {
void loop() {
//tp4app5
#include <LiquidCrystal.h>
void setup() {
void loop() {
lcd.clear();
lcd.clear();
lcd.clear();
lcd.print("SALAM"); // Afficher 'SALAM' sur l'écran LCD
//Tp5app1
/* @file HelloKeypad.pde
|| @version 1.0
|| @contact [email protected]
||
|| @description
|| #
*/
#include <Keypad.h>
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
void setup(){
Serial.begin(9600);
void loop(){
if (key){
Serial.println(key);
//tp5app2
#include <Keypad.h>
#include <LiquidCrystal.h>
};
// Initialiser le clavier
void setup() {
lcd.begin(16, 2);
void loop() {
if (key) {
lcd.clear();
lcd.print("Touche:");
lcd.setCursor(0, 1); // Positionner le curseur sur la deuxième ligne
lcd.print(key);
}//tp5app3
#include <Keypad.h>
#include <LiquidCrystal.h>
char keys[ROWS][COLS] = {
};
// Initialiser le clavier
void setup() {
lcd.begin(16, 2);
lcd.print("Enter Password:");
void loop() {
if (key) {
inputPassword += key;
lcd.clear();
lcd.print("Enter Password:");
lcd.print(inputPassword);
if (key == '#') {
if (inputPassword == password) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("OPEN");
} else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("ERREUR");
inputPassword = "";
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Enter Password:");