Simplifying code using arrays
Technic-R-C
Posts: 117
Hello,
I have a question in regards to the code i have pasted below.· I want to simplify it using an array instead of a bunch of numbers.· In other words I want to make one variable = to 8, 9, 10, 15, 14, 13.· I have read the index but I do not know how to approach this problem because the numbers i have chosen do not ascend in numerical order, rather they skip around a lot.· The code below is used to make the leds in a 8 digit led display move in a circle.· Can anyone simplify this with FOR loops and an array.
I have a question in regards to the code i have pasted below.· I want to simplify it using an array instead of a bunch of numbers.· In other words I want to make one variable = to 8, 9, 10, 15, 14, 13.· I have read the index but I do not know how to approach this problem because the numbers i have chosen do not ascend in numerical order, rather they skip around a lot.· The code below is used to make the leds in a 8 digit led display move in a circle.· Can anyone simplify this with FOR loops and an array.
' {$STAMP BS2px} ' {$PBASIC 2.5} DO '8, 9, 10, 15, 14, 13 led VAR Word HIGH 8 PAUSE 100 HIGH 9 PAUSE 100 HIGH 10 PAUSE 100 HIGH 15 PAUSE 100 HIGH 14 PAUSE 100 HIGH 13 PAUSE 100 LOW 8 PAUSE 100 LOW 9 PAUSE 100 LOW 10 PAUSE 100 LOW 15 PAUSE 100 LOW 14 PAUSE 100 LOW 13 PAUSE 100 LOOP
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
Works Great now
Technic-R-C
·