Skip to content

Commit

Permalink
Merge pull request #1 from behloulmedamine/main
Browse files Browse the repository at this point in the history
Get update from amine
  • Loading branch information
XdoctorwhoZ authored Oct 18, 2023
2 parents d2107c3 + a53b728 commit 56a3f8e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pico-firmware/src/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ typedef struct{
float voltage;
}Tenma_t;

#define STATE_ON "@"
#define STATE_OFF "!@"
#define STATE_ON "S"
#define STATE_OFF "0"
#define LOW 0
#define HIGH 1

int main() {

const uint LED_PIN = PICO_DEFAULT_LED_PIN;
gpio_init(LED_PIN);
gpio_set_dir(LED_PIN, GPIO_OUT);
gpio_put(LED_PIN, LOW);

Tenma_t tenma={.version="TENMA 72-2710 V6.8 SN:03265065", .state=0, .current=0.f, .voltage=0.f};
char serial_input[10], *current_substring, *voltage_substring;

Expand All @@ -44,10 +51,12 @@ int main() {
else if (!strcmp(serial_input,"OUT0"))
{
tenma.state = 0;
gpio_put(LED_PIN, LOW);
}
else if (!strcmp(serial_input,"OUT1"))
{
tenma.state = 1;
gpio_put(LED_PIN, HIGH);
}
else if (!strcmp(serial_input,"ISET1?"))
{
Expand Down

0 comments on commit 56a3f8e

Please sign in to comment.