Re: TinyScreen+ buttons and digital inputs

thompsc2

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
I have limited Arduino troubleshooting skills, but I have encountered 2 potential issues with the TinyScreen+.

The 1st is that the lower right button on the TS+ doesn't seem to work when serial communication is used. I have attached simple example code to demonstrate the problem.

The 2nd is that I can't get digital inputs to work with the TS+. I am designing a device that uses a rotary encoder which works great with the standard TinyScreen but not with the TS+. I tested buttons as the digital inputs and they work fine with the standard TS and TinyDuino, but not with the TS+. I have attached another simplified example sketch to demonstrate the problem. The 2 TinyScreen+'s I have seem to work fine otherwise.

Any help is much appreciated!


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
1) This seems to work correctly for me. Maybe you are seeing the processor get stuck at a "SerialUSB.print" call- when the buffer fills up, it waits. If there isn't a serial monitor open on the computer, it waits forever. Let me know what you find here.

2) The digitalWrite(HIGH,pin) call may not set the pullup resistor like it did with AVR boards. Using pinMode(INPUT_PULLUP,pin) is a way to do this on both processors.


thompsc2

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
You are right on both points. Thanks! Still can't get the TS+ to work with the rotary encoder for some reason, but works great with the standard TinyScreen and TinyDuino so I will go with that for now.


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
Glad that helps with the first two problems. I could take a quick look at the encoder code- that sort of thing should be compatible.


thompsc2

  • Jr. Member
  • **
    • Posts: 6
    • View Profile
Sorry for the delay. I was out of town and hadn't checked the forum in a while. Thank you for offering to look at the code. Here is the code I'm using with the rotary encoder and TS+ with some of the extraneous detail taken out. The encoder I'm using is an AMT-103 from CUI Inc if it helps at all. Thanks again!


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
Typically it's not recommended to use the 'delay' function in an interrupt- although I forget exactly how it's implemented for each processor. Just swapping delay(1) to delayMicroseconds(1000) should see if that has anything to do with it.

By the way, try the newer ThinPixel7 font included in font.h, it's a much nicer looking small font.


 

SMF spam blocked by CleanTalk