Main program direction
Brian Carpenter
Posts: 728
here is the current main menu
Main:
· GOSUB ADCChip
· GOSUB Memsic
· GOSUB Level
· GOSUB MotorVoltage
GOTO Main
but i only want it to do MotorVotage every 6th time through the cycle.· Any ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Main:
· GOSUB ADCChip
· GOSUB Memsic
· GOSUB Level
· GOSUB MotorVoltage
GOTO Main
but i only want it to do MotorVotage every 6th time through the cycle.· Any ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!
Comments
peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Peter C. Charles
Director, Research and Technology
CyberBiota, Incorporated
Peter.charles@cyberbiota.com
http://www.cyberbiota.com
Main:
· DO
····cycles =·cyles + 1 // 6
··· GOSUB ADCChip
·· ·GOSUB Memsic
·· ·GOSUB Level
····IF (cycles = 0) THEN
····· GOSUB MotorVoltage
··· ENDIF
· LOOP
The // (modulus) operator is vastly underutilized, and I find it much cleaner that IF-THEN logic for things like this.· Using // as I have above will force cycles to count from 0 to 5 and wrap back around.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Jon, thanks again. you definatly get around. i think that youu have answered evey one of my posts. that is very appriciated.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It's Only A Stupid Question If You Have Not Googled It First!!