per favore nuovamente arduino

May 05, 2021 6 Replies

Grazie in anticipo per la vostra cortesia. Mi sono imbattuto in uno sketch che scrive i dati direttamente sulla EEPROM arduino UNO. A un certo punto un commento (//) dice "se il



Ma quale ponticello? di che si tratta? ho esaminato la scheda di arduino ma non riesco a localizzare nessun ponticello. Grazie per un chiarimento a questa mia lacuna. Gab



https://www.avast.com/antivirus

Il 05/05/2021 12:12, Gab ha scritto:

Copio-incollo lo sketch per maggiore chiarezza. grazie ancora - Gab =================================

/* :Project: Datalogger su EEPROM :Author: Daniele Alberti :Website:

formatting link
:Revision: v1.0 :Date: 06/2017 :License: Creative Commons by-nc-sa 4.0

*/

#include const int ButtonPin = 2; //pin dove collegare il ponticello

unsigned long time; const long period = 1000; //periodo di salvataggio in EEPROM, in millisecondi

int EEPROMByteR = 0; int EEPROMByteW = 0;

byte DataReadEEPROM;

int Flag = 0;

void setup() { pinMode(ButtonPin, INPUT_PULLUP); pinMode(LedPin, OUTPUT); Serial.begin (57600);

if (digitalRead(ButtonPin)==LOW) { digitalWrite(LedPin, HIGH); for (int i = 0 ; i < EEPROM.length() ; i++) { EEPROM.write(i, 0); } digitalWrite(LedPin, LOW); } delay (10000); time = millis(); }

void loop() {

altrimenti si esegue la lettura, i dati verranno stampati su seriale*/

if (digitalRead(ButtonPin)==LOW) { if (EEPROMByteW < EEPROM.length()) { digitalWrite(LedPin, HIGH); if (millis() > (time + period)) { EEPROM.write(EEPROMByteW, DataToSave); EEPROMByteW++; time = millis(); } } else { digitalWrite(LedPin, LOW); } } else { if (Flag == 0) { digitalWrite(LedPin,HIGH); for (EEPROMByteR = 0; EEPROMByteR < EEPROM.length(); EEPROMByteR++) { DataReadEEPROM = EEPROM.read (EEPROMByteR); Serial.print (EEPROMByteR); Serial.println (DataReadEEPROM); Flag = 1; } } else { digitalWrite(LedPin,LOW); } } }

https://www.avast.com/antivirus

Il 05/05/2021 12:12, Gab ha scritto:

Non sono un esperto di arduini, ma secondo me si aspetta che tu metta un ponticello tra il pin 2 e GND. s

Il 05/05/2021 12:31, Simone ha scritto:

Se all'avvio trova il corto tra pin 2 e GND, cancella l'eeprom, altrimenti... il resto. s

programmato e messo in funzione, si comporta in maniera perfettamente onesta.

Il 5/5/21 12:28, Gab ha scritto:

(...)

massa, accende il LED su LedPin (I/O 13, LED sulla scheda Arduino) e

LED.

Il 05/05/2021 17:46, LAB ha scritto:

Grazie a tutti.

Gab

https://www.avast.com/antivirus

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required