Commit 9a5bf9fd authored by Pedro Henrique Kopper's avatar Pedro Henrique Kopper

Select channel based on requested id

parent 84ad49db
......@@ -11,8 +11,8 @@ void multi_req_cb(bool status, sadapmap_ReqMultiChannelReading *req) {
return; // Pacote inválido
float readings[req->id_count] = {0};
for(uint8_t i = 0; i < req->id_count; i++) {
// Por enquanto só manda de um canal
adc0.setMultiplexer(ADS1115_MUX_P0_NG);
// 0x04 pra medir single ended
adc0.setMultiplexer(req->id[i] | 0x04);
readings[i] = adc0.getMilliVolts(false);
}
iface.sendMultiChannel(req->id, readings, req->id_count);
......@@ -34,15 +34,5 @@ void setup() {
}
void loop() {
/*
digitalWrite(LED_BUILTIN, LOW);
adc0.setMultiplexer(ADS1115_MUX_P0_NG);
adc0.triggerConversion();
sendChannel(0, adc0.getMilliVolts(false));
digitalWrite(LED_BUILTIN, HIGH);
delay(100);
*/
iface.pollMulti();
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment