Hello everyone, I am having troubles writing code for this application.
I need to monitor ranges in inches from 5 sources simultaneously and if range falls within a certain parameter, to trigger a piezo speaker.
I have a client who is legally blind (can see shapes within 3-8') and is now a quadraplegic.
We are going to put range sensors on her power wheelchair, one each left right and rear, and two on the front. Each sensor will be accompanied by a piezo speaker.
When she is with 18" to 24" of an object (say, a wall) I want the speaker on that side to emit a tone with a set duration, if she continues in that direction (12" to 17") i want the tone to increase in pitch and duration, if she continues (6" to 11"), again an increase in pitch and duration.
I ran debug on the senor and these are the readings I got:
at 3': 12/$0C/%00001100
at 2': 8/$08/%00001000
at 18": 6/$06/ %00000110
at12": 4/$04/%00000100
at 6": 2/$02?%00000010
Here is the code I have so far, View attachment Wheelchair Range Sensor.bas
I have run syntax and it is getting hung up on {if b1< 16}.
I think by using the "start" command, I can have this picaxe monitoring all 4 quadrants at once, but am stumped as how to write the byte variable. Any help greatly appreciated.
I need to monitor ranges in inches from 5 sources simultaneously and if range falls within a certain parameter, to trigger a piezo speaker.
I have a client who is legally blind (can see shapes within 3-8') and is now a quadraplegic.
We are going to put range sensors on her power wheelchair, one each left right and rear, and two on the front. Each sensor will be accompanied by a piezo speaker.
When she is with 18" to 24" of an object (say, a wall) I want the speaker on that side to emit a tone with a set duration, if she continues in that direction (12" to 17") i want the tone to increase in pitch and duration, if she continues (6" to 11"), again an increase in pitch and duration.
I ran debug on the senor and these are the readings I got:
at 3': 12/$0C/%00001100
at 2': 8/$08/%00001000
at 18": 6/$06/ %00000110
at12": 4/$04/%00000100
at 6": 2/$02?%00000010
Here is the code I have so far, View attachment Wheelchair Range Sensor.bas
I have run syntax and it is getting hung up on {if b1< 16}.
I think by using the "start" command, I can have this picaxe monitoring all 4 quadrants at once, but am stumped as how to write the byte variable. Any help greatly appreciated.
Last edited: