TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: thompsc2 on August 07, 2016, 12:07:35 AM

Title: Re: TinyScreen+ buttons and digital inputs
Post by: thompsc2 on August 07, 2016, 12:07:35 AM
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!
Title: Re: Re: TinyScreen+ buttons and digital inputs
Post by: Ben Rose on August 08, 2016, 06:24:29 PM
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.
Title: Re: TinyScreen+ buttons and digital inputs
Post by: thompsc2 on August 11, 2016, 12:35:34 AM
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.
Title: Re: Re: TinyScreen+ buttons and digital inputs
Post by: Ben Rose on August 15, 2016, 06:22:06 PM
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.
Title: Re: TinyScreen+ buttons and digital inputs
Post by: thompsc2 on August 29, 2016, 01:14:41 AM
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!
Title: Re: Re: TinyScreen+ buttons and digital inputs
Post by: Ben Rose on September 04, 2016, 02:54:01 PM
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.