start:arduino:mcp23017:dfrobot
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
start:arduino:mcp23017:dfrobot [2022/03/29 10:50] – [Exemple de code 4- Interruption IO] gerardadmin | start:arduino:mcp23017:dfrobot [2023/01/27 16:08] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 2: | Ligne 2: | ||
[[https:// | [[https:// | ||
+ | |||
+ | ==== Achat ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | [[https:// | ||
{{ : | {{ : | ||
Ligne 517: | Ligne 525: | ||
{{ : | {{ : | ||
+ | ====Connexion en cascade==== | ||
+ | {{ : | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | ==== Schema du DFT0626 - MCP23017 DFROBOT ==== | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | |||
+ | ==== Doc technique MCP23017 ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | |||
+ | ===== Programme APC220 (Sans fil) et MCP23017 | ||
+ | |||
+ | <code c Emmision_ESP32_LED_BP_APC220_MCP23017.ino> | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | HardwareSerial Sender(2); | ||
+ | |||
+ | #define Sender_Txd_pin 17 | ||
+ | #define Sender_Rxd_pin 16 | ||
+ | |||
+ | int EtatLED = 0; | ||
+ | int EtatBP = 0; | ||
+ | int EtatPrecd = 0; | ||
+ | int EtatLEDPrecd =0; | ||
+ | bool Unefois = false; | ||
+ | |||
+ | |||
+ | DFRobot_MCP23017 mcp027(Wire, | ||
+ | |||
+ | //Prepare: connect the LED to a digital pin of IO expansion board(eg: | ||
+ | void setup(void) | ||
+ | { | ||
+ | | ||
+ | | ||
+ | |||
+ | while(mcp027.begin() != 0){ | ||
+ | Serial.println(" | ||
+ | | ||
+ | } | ||
+ | |||
+ | |||
+ | mcp027.pinMode(/ | ||
+ | mcp027.pinMode(/ | ||
+ | |||
+ | } | ||
+ | |||
+ | void loop(void) | ||
+ | { | ||
+ | EtatPrecd = EtatBP ; | ||
+ | EtatBP = mcp027.digitalRead(/ | ||
+ | delay(100); | ||
+ | // | ||
+ | // | ||
+ | / | ||
+ | Serial.print(" | ||
+ | Serial.println(verrou); | ||
+ | |||
+ | | ||
+ | Serial.print(" | ||
+ | // | ||
+ | EtatLEDPrecd = EtatLED; | ||
+ | EtatLED = !EtatLED; | ||
+ | Serial.print(" | ||
+ | Serial.println(EtatLED); | ||
+ | } | ||
+ | if(EtatLED == 0 ){ | ||
+ | mcp027.digitalWrite(mcp027.eGPB0, | ||
+ | if ( Unefois == false ) { | ||
+ | Sender.print(" | ||
+ | Unefois = !Unefois ; | ||
+ | } | ||
+ | Serial.print(" | ||
+ | Serial.println(EtatLED ); | ||
+ | delay(100); | ||
+ | |||
+ | } | ||
+ | else if (( EtatLED ==1 ) && (EtatLEDPrecd == 0)) { | ||
+ | mcp027.digitalWrite(mcp027.eGPB0, | ||
+ | // | ||
+ | if ( Unefois == true) { | ||
+ | Sender.print(" | ||
+ | Unefois = !Unefois ; | ||
+ | } | ||
+ | Serial.print(" | ||
+ | Serial.println(EtatLED ); | ||
+ | delay(100); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ | ||
/home/chanteri/www/fablab37110/data/attic/start/arduino/mcp23017/dfrobot.1648543803.txt.gz · Dernière modification : 2023/01/27 16:08 (modification externe)