Why can't I get HIGH on digital output?

I want 2 LEDs to blink every second with my D21G, but it didn't work so I used lcd to see what's going on and it's always 

HIGH Dig: 00

LOW Dig:00

#include <Wire.h>
#include <UC1701.h>
#include <Indio.h>

static UC1701 lcd;

void setup() {
 
  Indio.digitalMode(1, OUTPUT); // Set CH1 as an output
  Indio.digitalMode(2, OUTPUT); // Set CH2 as an output
  Indio.digitalWrite(1, LOW); 
  Indio.digitalWrite(2, LOW);
  lcd.begin();  //set the resolution of the LCD screen

  for (int y = 0; y <= 7; y++) {
    for (int x = 0; x <= 128; x++) {
      lcd.setCursor(x, y);
      lcd.print(" ");
    }
  }
}

void loop() {
 
  lcd.clear(); //clear the screen
  lcd.setCursor(0, 2);
  lcd.print("HIGH Dig: ");
  Indio.digitalWrite(1, HIGH);
  Indio.digitalWrite(2, HIGH);
  lcd.print(Indio.digitalRead(1), BIN);
  lcd.print(Indio.digitalRead(2), BIN);
  delay(1000);
  lcd.clear(); //clear the screen
  lcd.setCursor(0, 2);
  lcd.print("LOW Dig: ");
  Indio.digitalWrite(1, LOW);
  Indio.digitalWrite(2, LOW);
  lcd.print(Indio.digitalRead(1), BIN);
  lcd.print(Indio.digitalRead(2), BIN);
  delay(1000);
  
}

Nikola
Nikola
4
| 2 1 1
Asked on 5/4/18, 9:40 PM
0
vote
1732 Views

Hi Nikola,

Can you confirm that you are powering the INDIO with external 12/24V, as the I/O will not work on USB power only.

If you already had the external power connected, then i suggest you include a digitalMode(x, INPUT) before you do the digitalRead() and/or a digitalMode(x, OUTPUT) before digitalWrite(). I'm not sure if you can Read when the channel is defined as output and vice versa Write on input. Let us know if you need more help on this.

Tom
Tom
5675
| 1 1 3
Answered on 5/5/18, 1:40 AM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

44 follower(s)

Stats

Asked: 5/4/18, 9:40 PM
Seen: 1732 times
Last updated: 5/5/18, 1:40 AM