diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f3276a..8d255f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 0.0.16 + +* Bugfix: Ensure that analog reads return unsigned values. + ### 0.0.15 * Add the ability to do analog reads. diff --git a/src/main.cpp b/src/main.cpp index aa6f74b..420469f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -315,7 +315,7 @@ int gpio_digital_read(CommandRouter *cmd, int argc, const char **argv) { uint8_t pin = strtol(argv[1], nullptr, 0); uint8_t value = digitalRead(pin); - snprintf(cmd->buffer, cmd->buffer_size, "%d", value); + snprintf(cmd->buffer, cmd->buffer_size, "%u", value); return 0; } @@ -339,7 +339,7 @@ int analog_read(CommandRouter *cmd, int argc, const char **argv) { uint8_t pin = strtol(argv[1], nullptr, 0); uint8_t value = analogRead(pin); - snprintf(cmd->buffer, cmd->buffer_size, "%d", value); + snprintf(cmd->buffer, cmd->buffer_size, "%u", value); return 0; }