Keyboard 3.5 fail, help from someone with an earlier teensy please ?

Status
Not open for further replies.

Beelz

New member
I found the page where teensy 3.5 is not fully compliant with keyboard, but since I had one already I thought I'd give it a shot.

Bare Bones, my code seemed feasible. Yes/No?
Code:
//#include <Keyboard.h>;
const int analogPin = 32;

void setup(){
pinMode(0, INPUT_PULLUP);
digitalWrite(0, HIGH);
}

void loop(){ProcessKeys();}

void ProcessKeys()
{ 
  int analogValue = analogRead(analogPin);
     if (digitalRead(0) == LOW){
        if (analogValue <= 50){
        Keyboard.write('=');
        }
     }  
 }

Now my results are somewhat.. questionable. In the two seconds before I hit the HalfKey, notepad obtained this data:
==t=?=w=Y===:=a=*=U=B=X=Z=]=W=2=*=)=v=`=f===
=2====R=J=Q=\=/=<=K=6==!=D=+=4===-===?==P=w=V=y={=%=9=F=?=>==W= =9=A=<====B=;=;=====@==Z=;=8=8=G===-=<=t=W=A==6==$=2=
=&="=:=="=%=== =h=H=V=X=E==#=U=V=]====u=<=/=3=:=%=1=:=9=/=6=%==(=>=A=8=<= =-=1=7=9=*= =B=k=H=;==(=)=~=z=N=N=B=/== =Z=B=V=%=X=\=[=="=M=:=C=>=O=C=(=!=
=T=u=U==A=d=C===>=G=D=D==B==3===A=<===[=
==Z=k===9=I=M=;=U==B=S=_=)=@=$= =l=u=:=-=)=c=q=Y=(=s=;=?==4=-===?=*=8=A==G=:=%=6=<=+===.=
==<==A=T=>=E==4=#=s=e==1===B=U=W=[=E==2=B=Y=q=|=Z=+=U=C=(=?=O=w=#=9==)=.=6=9=D=Z=@=I=c=;=W==E=G=="=:=D=C=w=<=====s=K====*=q=(=Q==1=?=>=A=?=-=8==B==#=V=X=`=D=?=1=<=
=@=l=p=A='=F=9==/=-=Y=w=V=U==;=K=8=B=E=@==(===;="=#=(=0=3=3=K=<=;=?=F=D=x=v=T=;==+=Y=I=Y=6=k=@=b=B=Y===U=w===:=F=0=H=C=z=V=="=2=>=R=!=,=D==;=P=`=N=S=:=`=;=@=V=.=D=J=3=R=%=<==0=D=$=l==@=7=?=U=b==7=.=H=V====)=i=(=,=U=h=L=Y==
=`=Y=P=,===;=R=A=a=)=
=Y=2=%=6=8=T=a=?===:=_= =2=N=g=B=B=A= =)==E=b=|='=:=Y=C=z=Z=C=S=t==2=`=T=d===A=@=8=<=k= =0=C==<=-= = =U=(=g=U=A=====>=*==B==
=D=;="=:=W=:=`=\=?=A=4=<==@=+=z=J==6=====1= =9=;=D===
= =:===9==9=7=8=G===A=p=a=9=8=4=U=w==
=S=z=(==@=2=%=
===n=h=B=>=<=-==`=r=_=*==9=="=-=(=u==== =b=A=F= =E======|=B=@=-=A=C=c=F=a=
=Q=8=;=T=A=%=T=`=D=.=;=<=8=T=9= = =A===a=G=W=

So Half this data is gibberish, and the other half prints regardless of button being HIGH, LOW, whatever. Analog adjustments also make no difference, it's all just nonsense output

Removal of the ProcessKeys() method yields the same result. Gibberish from empty code.
Can somebody run my code through a Teensy2 or something before I go out n buy one por favor?


I'm using a wiring from the RaspberryPi where I had a digital only sample working for an example where the view updated text properly, but peripherals with analog are the way to go with my projects. Included is a clip of the tip. Button to ground, button to Pin0. Analog to ground, Analog to 3v, middle pin to Pin32.
Aside from having a messy breadboard, it should all be theoretically sound, as my first analog project. Any idea if the crappy potentiometer what done come with my Pi should work properly for this?
 

Attachments

  • buttonSample.jpg
    buttonSample.jpg
    9.7 KB · Views: 144
Would suggest putting a delay(10); in your loop to prevent things from getting out of control, since at the moment that will try and send a lot of characters and quite possibly hit limits in the USB side of things that may be where the corruption comes from.

Doing a digital write to pin13 (the LED) for the state read from your button may be useful in place of chewing up notepad, as will getting a meter in there to find out if it really is being pulled low by something in a way that's not right.

Setting pin 0 to high isn't doing much on a teensy 3.5
 
I tried just now. Seems to work fine.

Here's a screenshot where lots of "=" printed when I press the button.

sc.png

Here's the circuitry I tested.

DSC_0529_web.jpg

I did this test with Linux. Maybe something is going wrong with Windows when Teensy sends fast?
 
Its a miracle!!!
Lol all I did was lower the clock speedto 96 Mhz in my WinDuino. Does make me think about Linuxing up my old laptop though, since my RaspBuntu doesn't support Teensy 3.xx
So thanks to you, Meister Paul, for the brilliant clock idea. Had to do a double take on your potentiometer though, your ground wire looked like it was sticking out of your analog wire from this angle, and your fancy buttons compared to mine 0.o
And to The Wrangler, thanks for the tip but I had scrapped the extra code for a deeper understanding of why the androgynous characters were popping up in the first place. In this experiment it was not the timing I was worried about, but the extravagant sentience that my device seemed to be displaying XP
Ah well I'll rig this up to my grander experiment when I get a moment. Allose All!
 
Status
Not open for further replies.
Back
Top