newbie: help with array!
paradrape
Posts: 3
hi forum,
i'm trying to do something simple and i hope you can help.
I have a list of numbers of Air Quality data from Beijing that i'm trying to visualize using the BS2. I want to write some code that will look at a number in the list, see if it is between certain values, then do something based on the outcome.
my pseudoish code is here:
----
Air_Quality_Data· DATA 35, 47, 78, 102, 123, 153, 89, 190, 54, 34, 86, 75, 123
(here i need some code where each successive value in the list is set to a variable, call it "i", and the value of "i" is
evaluated by the code below, sending data to the board)
Activate:
· ELSEIF (i > 50) AND (i < 100) THEN
··· PULSOUT 2, 2000
· ELSEIF (i > 100) THEN
··· PULSOUT 2, 2000
··· PULSOUT 8, 2000
· ENDIF
RETURN
----
can you help me fill in the blanks and correct my code?
thanks. this is the first time i've done this and i'm a bit stuck even with the manual.
- paradrape
i'm trying to do something simple and i hope you can help.
I have a list of numbers of Air Quality data from Beijing that i'm trying to visualize using the BS2. I want to write some code that will look at a number in the list, see if it is between certain values, then do something based on the outcome.
my pseudoish code is here:
----
Air_Quality_Data· DATA 35, 47, 78, 102, 123, 153, 89, 190, 54, 34, 86, 75, 123
(here i need some code where each successive value in the list is set to a variable, call it "i", and the value of "i" is
evaluated by the code below, sending data to the board)
Activate:
· ELSEIF (i > 50) AND (i < 100) THEN
··· PULSOUT 2, 2000
· ELSEIF (i > 100) THEN
··· PULSOUT 2, 2000
··· PULSOUT 8, 2000
· ENDIF
RETURN
----
can you help me fill in the blanks and correct my code?
thanks. this is the first time i've done this and i'm a bit stuck even with the manual.
- paradrape
Comments
aux var nib
i var byte(12) 'take a look here that I'm based on your example were all the values are under value 255 (witch fit into a byte) and you are checking 13 values
j var byte 'just a place to work with the numbers
FOR aux=0 TO 12
j = i(aux)
GOSUB Activate
next
'keep up with the tasks
Hope to help
Amaral
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the blue smoke comes out of a Basic Stamp... You know that you did something wrong... -- Matthew