arduino:ds2450
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| arduino:ds2450 [2022/02/28 21:28] – created aistis | arduino:ds2450 [2022/02/28 21:43] (current) – aistis | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | DS2450 | + | DS2450 |
| - | esp32 | + | library code copy to sketch dir |
| https:// | https:// | ||
| Line 8: | Line 8: | ||
| + | <code cpp> | ||
| + | /* | ||
| + | | ||
| + | * | ||
| + | | ||
| + | | ||
| + | | ||
| + | * | ||
| + | | ||
| + | * | ||
| + | | ||
| + | * | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | * | ||
| + | */ | ||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | #include " | ||
| + | |||
| + | // define the Arduino digital I/O pin to be used for the 1-Wire network here | ||
| + | const uint8_t ONE_WIRE_PIN = 5; | ||
| + | |||
| + | // define the 1-Wire address of the DS2450 quad a/d here (lsb first) | ||
| + | //uint8_t DS2450_address[] = { 0x20, 0x1C, 0x86, 0x00, 0x00, 0x00, 0x00, 0x9E }; | ||
| + | uint8_t DS2450_address[] = { 0x20, 0xD9, 0x37, 0x06, 0x00, 0x00, 0x00, 0x61 }; | ||
| + | |||
| + | OneWire ow(ONE_WIRE_PIN); | ||
| + | DS2450 ds2450(& | ||
| + | |||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | ds2450.begin(); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | ds2450.update(); | ||
| + | if (ds2450.isError()) { | ||
| + | Serial.println(" | ||
| + | } else { | ||
| + | for (int channel = 0; channel < 4; channel++) { | ||
| + | Serial.print(" | ||
| + | Serial.print(char(' | ||
| + | Serial.print(" | ||
| + | Serial.print(ds2450.getVoltage(channel), | ||
| + | if (channel < 3) { | ||
| + | Serial.print(" | ||
| + | } else { | ||
| + | Serial.println(" | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | delay(500); | ||
| + | } | ||
| + | |||
| + | </ | ||
arduino/ds2450.1646076525.txt.gz · Last modified: by aistis
