10 liens privés
connection client à un serveur ble
protcole de communication maison en 433
sleep mode arduino
/*
Five Finger Code Finder (C)2017, 2018 Carl Smith
Unlocks car doors with DeBruijn minimal length sequence
NOTE: I am not very experienced with Arduino or C++ code and I am sure there
are many improvements to be made to this code, as small as it is.
With delay=100 it does about 291 keypresses per minute and finishes the entire
sequence in 10 minutes and 45 seconds.
NOTE: There is a chance that this thing will reprogram your door code.
Before experimenting be sure you know the unchangable factory code and
how to reset your code.
*/
// include the library code:
#include <LiquidCrystal.h>
#include <avr/pgmspace.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
/ NOTE: I had to add four 1's to the end of the following sequence to get it to
test 99991, 99911, 99111, and 91111. The Wikipedia program that generates the
sequence treats it like a circle - all the codes are not tested unless you are
going around continuously. It really takes 3129 presses to test 3125 codes since
the first four presses do not complete a five digit code.
/
const PROGMEM char debruijn5of5[] = {
1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 5, 1, 1, 1, 1, 7, 1, 1, 1, 1, 9, 1, 1, 1, 3, 3, 1, 1, 1, 3,
5, 1, 1, 1, 3, 7, 1, 1, 1, 3, 9, 1, 1, 1, 5, 3, 1, 1, 1, 5, 5, 1, 1, 1, 5, 7, 1, 1, 1, 5,
9, 1, 1, 1, 7, 3, 1, 1, 1, 7, 5, 1, 1, 1, 7, 7, 1, 1, 1, 7, 9, 1, 1, 1, 9, 3, 1, 1, 1, 9,
5, 1, 1, 1, 9, 7, 1, 1, 1, 9, 9, 1, 1, 3, 1, 3, 1, 1, 3, 1, 5, 1, 1, 3, 1, 7, 1, 1, 3, 1,
9, 1, 1, 3, 3, 3, 1, 1, 3, 3, 5, 1, 1, 3, 3, 7, 1, 1, 3, 3, 9, 1, 1, 3, 5, 3, 1, 1, 3, 5,
5, 1, 1, 3, 5, 7, 1, 1, 3, 5, 9, 1, 1, 3, 7, 3, 1, 1, 3, 7, 5, 1, 1, 3, 7, 7, 1, 1, 3, 7,
9, 1, 1, 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 5, 7, 5, 7, 5, 5, 7, 5, 9, 5, 5, 7, 7, 7, 5, 5, 7, 7, 9, 5, 5, 7, 9, 7, 5, 5,
7, 9, 9, 5, 5, 9, 5, 7, 5, 5, 9, 5, 9, 5, 5, 9, 7, 7, 5, 5, 9, 7, 9, 5, 5, 9, 9, 7, 5, 5,
9, 9, 9, 5, 7, 5, 7, 7, 5, 7, 5, 7, 9, 5, 7, 5, 9, 7, 5, 7, 5, 9, 9, 5, 7, 7, 5, 9, 5, 7,
7, 7, 7, 5, 7, 7, 7, 9, 5, 7, 7, 9, 7, 5, 7, 7, 9, 9, 5, 7, 9, 5, 9, 5, 7, 9, 7, 7, 5, 7,
9, 7, 9, 5, 7, 9, 9, 7, 5, 7, 9, 9, 9, 5, 9, 5, 9, 7, 5, 9, 5, 9, 9, 5, 9, 7, 7, 7, 5, 9,
7, 7, 9, 5, 9, 7, 9, 7, 5, 9, 7, 9, 9, 5, 9, 9, 7, 7, 5, 9, 9, 7, 9, 5, 9, 9, 9, 7, 5, 9,
9, 9, 9, 7, 7, 7, 7, 7, 9, 7, 7, 7, 9, 9, 7, 7, 9, 7, 9, 7, 7, 9, 9, 9, 7, 9, 7, 9, 9, 7,
9, 9, 9, 9, 9, 1, 1, 1, 1};
const int button1Pin = 14; //Analog A0 pin
const int button2Pin = 15; //Analog A1 pin
const int button3Pin = 16; //Analog A2 pin
const int button4Pin = 17; //Analog A3 pin
const int button5Pin = 18; //Analog A4 pin
const int solenoid1Pin = 6;
const int solenoid2Pin = 7;
const int solenoid3Pin = 8;
const int solenoid4Pin = 9;
const int solenoid5Pin = 10;
const int state_Start = 1;
const int state_Run = 2;
const int state_Stop = 3;
int timer = 100; // Time in milliseconds between keypresses
int i = 0; // loop counter
unsigned char currentdigit; // hold value read from sequence stored in program memory
String line2 = " "; // Start with 16 spaces on second line of LCD
void setup()
{
// set up the LCD's number of columns and rows and print project name
lcd.begin(16, 2);
lcd.print("5FCF-CDS");
pinMode(button1Pin, INPUT_PULLUP);
pinMode(button2Pin, INPUT_PULLUP);
pinMode(button3Pin, INPUT_PULLUP);
pinMode(button4Pin, INPUT_PULLUP);
pinMode(button5Pin, INPUT_PULLUP);
pinMode(solenoid1Pin, OUTPUT);
pinMode(solenoid2Pin, OUTPUT);
pinMode(solenoid3Pin, OUTPUT);
pinMode(solenoid4Pin, OUTPUT);
pinMode(solenoid5Pin, OUTPUT);
lcd.setCursor(0, 1); // Move cursor to first column, second row
lcd.print("PRESS START");
while (digitalRead(button1Pin) == HIGH) {} //Loop until button pressed
while (digitalRead(button1Pin) == LOW) {} //Then wait for release
// loop through whole DeBruijn sequence
for (i = 0; i < (sizeof(debruijn5of5)/sizeof(debruijn5of5[0])); i++)
{
solenoidsOff();
if (digitalRead(button1Pin) == LOW) pausemode(); // If necessary pause between solenoid presses
currentdigit = pgm_read_word_near(debruijn5of5 + i);
lcd.setCursor(0, 1); // Move cursor to first column, second row
//Drop leftmost digit and add new one to right end by
//adding new digit to the substring starting with the second digit
line2 = line2.substring(1) + currentdigit;
lcd.print (line2);
lcd.setCursor(12, 0); // Move cursor to column 13, first row
lcd.print(i+1); // Print index of current digit on top row, left end
// but add one since array count starts at zero
delay (timer);
solenoidOn(currentdigit);
delay (timer); // Slow the universe down so we can see it work
}
solenoidsOff(); // Sequence is over, shut off solenoids
}
void pausemode()
{
lcd.setCursor(0, 0); // Move cursor to first column, first row
lcd.print("PAUSED ");
delay (200);
while (digitalRead(button1Pin) == LOW) {} //Button is low when we get here. Wait for release.
solenoidsOff(); //Don't want solenoids to sit and cook while in pause.
while (digitalRead(button1Pin) == HIGH) //Now wait for button press again to restart.
{ checkBackForward(); } //But check for back and forward buttons while waiting.
lcd.setCursor(0, 0); // Move cursor to first column, first row
lcd.print("5FCF-CDS");
}
void checkBackForward()
{
if (digitalRead(button2Pin) == LOW) //Back Button Pressed
{
lcd.setCursor(0, 0); // Move cursor to first column, first row
lcd.print("BACK ");
delay (200);
while (digitalRead(button2Pin) == LOW) {} //Button is low when we get here. Wait for release.
i -= 16;
if (i < 0) { i = 0; }
}
if (digitalRead(button3Pin) == LOW) //Forward Button Pressed
{
lcd.setCursor(0, 0); // Move cursor to first column, first row
lcd.print("FORWARD ");
delay (200);
while (digitalRead(button3Pin) == LOW) {} //Button is low when we get here. Wait for release.
i += 16;
}
line2 = " ";
lcd.setCursor(12, 0); // Move cursor to column 13, first row
lcd.print(i); // Print index of current digit on top row, left end
lcd.print(" ");
}
void solenoidOn (unsigned char sol)
{
if (sol == 1) { digitalWrite(solenoid1Pin, 1); }
if (sol == 3) { digitalWrite(solenoid2Pin, 1); }
if (sol == 5) { digitalWrite(solenoid3Pin, 1); }
if (sol == 7) { digitalWrite(solenoid4Pin, 1); }
if (sol == 9) { digitalWrite(solenoid5Pin, 1); }
}
void solenoidsOff()
{
digitalWrite(solenoid1Pin, 0);
digitalWrite(solenoid2Pin, 0);
digitalWrite(solenoid3Pin, 0);
digitalWrite(solenoid4Pin, 0);
digitalWrite(solenoid5Pin, 0);
}
void loop(){}
/*
*/
const char message[] PROGMEM = {"0000000000001000000000011000000000101000000000111000000001001000000001011000000001101000000001111000000010001000000010011000000010101000000010111000000011001000000011011000000011101000000011111000000100001000000100011000000100101000000100111000000101001000000101011000000101101000000101111000000110001000000110011000000110101000000110111000000111001000000111011000000111101000000111111000001000001000011000001000101000001000111000001001001000001001011000001001101000001001111000001010001000001010011000001010101000001010111000001011001000001011011000001011101000001011111000001100001000001100011000001100101000001100111000001101001000001101011000001101101000001101111000001110001000001110011000001110101000001110111000001111001000001111011000001111101000001111111000010000101000010000111000010001001000010001011000010001101000010001111000010010001000010010011000010010101000010010111000010011001000010011011000010011101000010011111000010100011000010100101000010100111000010101001000010101011000010101101000010101111000010110001000010110011000010110101000010110111000010111001000010111011000010111101000010111111000011000011000101000011000111000011001001000011001011000011001101000011001111000011010001000011010011000011010101000011010111000011011001000011011011000011011101000011011111000011100011000011100101000011100111000011101001000011101011000011101101000011101111000011110001000011110011000011110101000011110111000011111001000011111011000011111101000011111111000100010001001100010001010100010001011100010001100100010001101100010001110100010001111100010010001100010010010100010010011100010010100100010010101100010010110100010010111100010011001100010011010100010011011100010011100100010011101100010011110100010011111100010100010100011100010100100100010100101100010100110100010100111100010101001100010101010100010101011100010101100100010101101100010101110100010101111100010110001100010110010100010110011100010110100100010110101100010110110100010110111100010111001100010111010100010111011100010111100100010111101100010111110100010111111100011000110100011000111100011001001100011001010100011001011100011001100100011001101100011001110100011001111100011010010100011010011100011010100100011010101100011010110100011010111100011011001100011011010100011011011100011011100100011011101100011011110100011011111100011100011100100100011100101100011100110100011100111100011101001100011101010100011101011100011101100100011101101100011101110100011101111100011110010100011110011100011110100100011110101100011110110100011110111100011111001100011111010100011111011100011111100100011111101100011111110100011111111100100100100101100100100110100100100111100100101001100100101010100100101011100100101101100100101110100100101111100100110010100100110011100100110101100100110110100100110111100100111001100100111010100100111011100100111101100100111110100100111111100101001010100101001011100101001101100101001110100101001111100101010011100101010101100101010110100101010111100101011001100101011010100101011011100101011101100101011110100101011111100101100101100110100101100111100101101001100101101010100101101011100101101101100101101110100101101111100101110011100101110101100101110110100101110111100101111001100101111010100101111011100101111101100101111110100101111111100110011001101010011001101110011001110110011001111010011001111110011010011010011110011010101010011010101110011010110110011010111010011010111110011011001110011011010110011011011010011011011110011011101010011011101110011011110110011011111010011011111110011100111010011100111110011101010110011101011010011101011110011101101010011101101110011101110110011101111010011101111110011110011110101010011110101110011110110110011110111010011110111110011111010110011111011010011111011110011111101010011111101110011111110110011111111010011111111110101010101011101010101101101010101111101010110101101010110111101010111011101010111101101010111111101011010111101011011011101011011101101011011111101011101011101101101011101111101011110111101011111011101011111101101011111111101101101101111101101110111101101111011101101111111101110111011111110111101111110111110111111111111"};
void setup() {
pinMode(13, OUTPUT);
for (int i = 0; i <= strlen_P(message); i++) {
int bit_en_cours = pgm_read_byte_near(message + i);
Serial.println(bit_en_cours);
if (bit_en_cours == 0){
digitalWrite(10, LOW);
}
if (bit_en_cours == 1){
digitalWrite(10, HIGH);
}
delayMicroseconds(425);
}
}
void loop() {
}
bytes = [105,110,102,111,32,73,110,97,99,99,101,115,105,98,108,101,13,10]
print("".join(map(chr, bytes)))
pour compter le temps dans un programme...