Shop OBEX P1 Docs P2 Docs Learn Events
readPin question — Parallax Forums

readPin question

fearnotfearnot Posts: 13
edited 2006-08-08 03:41 in General Discussion
For some reason, I can write to pin using CPU.writePin but can't read it correctly. For basic test, I simply gave 5V DC to pin0 with 1k resistor with the following code

import stamp.core.*;
public class Test{
· public static void main(){
· int count = 30;
··· while (count > 0){
····· if (CPU.readPin(0) == true){
······· System.out.println("pin 0 is true");
····· }else {
··············· System.out.println("Pin 0 is false");
··········· }
····· CPU.delay(10000);
····· count--;
··· }
· }
}

and I get "pin 0 is false" all the time even though it is getting 5 volts straight out of battery. Any help please?

Comments

Sign In or Register to comment.