Il lavoro che devo fare consiste nel poter avere controllate da ARDUINO 2 sonde di lettura per la misurazione PH e 2 sonde per la misurazione ORP.
Ho acuistato questi circuiti HP e ORP
http://www.atlas-scientific.com/Arduino-ph.html e fatti lavorare singolarmente sfruttando la libreria NewSoftSerial per TX/RX virtuali sono risuciot a farle funzionare (la loro documentazione era ben fatta). Però essendo 4 sonde, sempre prendendo spunto dalla loro documentazione, volevo collegarle ad un 4052 come da loro indicato ma purtroppo non riesco a farlo funzionare. I collegamenti sono abbastanza certo di averli fatti giusti ma a livello di codice e di come utilizzare il 4052 come ingresso diciamo che non ho trovato spiegazioni o applicazioni da cui trarre spunto (copiare

).
Mi potete gentilmente dare una mano.Magari dandomi qualche dritta su dove trovare esempi di utilizzo di questo multiplex?
Il risultato che ho sul serial monitor è sostanzialemtne questo:
check probe che )9 6 8 check probecheck
Úª*
N©ÊJúûÚ
quello che invece mi aspettavo e che compariva al regolare funzionamento sarebbe stato il seguente che diceva di verificare la sonda
check probe
check probe
il codice utilizzato è il seguente ed è per solo un sonda , suppongo che ci sia qualche cosa di non sincronizzato relativamente alla trasmissione del dato ma non avrei ide di cosa
char stamp_data[15]; //this is where the data from the stamp is stored. The array is 15 char long because
//if no pH probe is connected, the message "check probe" is transmitted.
//Having an array that is to small will cause data corruption and could cause the Arduino to crash.
byte holding; //used to tell us the number of bytes that have been received by the Arduino and are holding in the buffer holding
byte i; //counter
byte startup=0; //used to control the start-up sequence
#include <NewSoftSerial.h> //this will let the software take advantage of the "newsoftserial" library.
NewSoftSerial mySerial = NewSoftSerial(5, 6); //setup and rename soft uart.
// RX|TX
void setup()
{
pinMode(2, OUTPUT); // s0
pinMode(3, OUTPUT); // s1
pinMode(4, OUTPUT); // E
Serial.begin(38400);
mySerial.begin(38400); //set up the soft serial to run at 38400
}
void loop () {
// L L L Y0
// L L H Y3
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
if(startup==0){ //if the start-up sequence has not been run
for(i=1; i <= 2;i++){ //we go through this for-loop twice, turning on/ off the stamp leds
delay(1000); //wait 1 second
mySerial.print("l0"); //turn off the led
mySerial.print(13,BYTE); //ALWAYS end a command with <CR> (which is simply the number 13) or (print("/r")
delay(1000); //wait 1 second
mySerial.print("l1"); //turn on the led
mySerial.print(13,BYTE); //ALWAYS end a command with <CR> (which is simply the number 13) or (print("/r")
}
startup=1; //stop the star-tup loop from happening by setting the startup var to 1
delay(1000); //after the stamp leds flashed twice, lets wait 1 second befor we give the stamp a new command
mySerial.print("c"); //the command "c" will tell the stamp to take continues readings
mySerial.print(13,BYTE); //ALWAYS end a command with <CR> (which is simply the number 13) or (print("/r")
delay(1000);
//to take a single reading
//you would simple send the command
//mySerial.print("r");
//mySerial.print(13,BYTE);
//to take a temperature dependent reading
//send the temperature in celsius, let's say
//the temperature in celsius is 18.5
//mySerial.print("18.5");
//mySerial.print(13,BYTE);
}
if(mySerial.available() > 3) { //if we see the more then three bytes have been received by the Arduino
holding=mySerial.available(); //lets read how many bytes have been received
for(i=1; i <= holding;i++){ //we make a loop that will read each byte we received
stamp_data[i]= mySerial.read(); //and load that byte into the stamp_data array
}
for(i=1; i <= holding;i++){ //we now loop through the array
Serial.print(stamp_data[i]); //printing each byte we recived through the hardware UART
}
Serial.println(""); //once we finished, we print a nul char with the <CR><LF> command.
}
}
grazie