Shop OBEX P1 Docs P2 Docs Learn Events
Javelin syntax question — Parallax Forums

Javelin syntax question

basicstampedebasicstampede Posts: 214
edited 2004-09-10 20:34 in General Discussion
In the program below, final static int LEDpin = CPU.pin0 works, but not
····························· final static int LEDpin = CPU.pins[noparse][[/noparse]0].· Why not?

Also, why do we need to say "int" in above statement as I tried "char", and "short" with success (but "long" does not work.)· Can anyone explain why this is so?

BTW, this is my attempt to duplicate ex1 from StampWorks into Javelin.·

·import stamp.core.*;
···· public class ex1 {
······ //final static int LEDpin = CPU.pin0;····· //works
······ final static int LEDpin = CPU.pins[noparse][[/noparse]0];·· // Error IDE-0042 Unknown unhandled exception in JVM [noparse][[/noparse]527]
······ public static void main() {
········ int mydelay=10000;
········ while (true) {
·········· CPU.writePin (LEDpin, true);
·········· CPU.delay (mydelay);
·········· CPU.writePin (LEDpin, false);
·········· CPU.delay (mydelay);
········ }
······ }
··· }
Sign In or Register to comment.