donrecardo
Senior Member
Being a beginner my experiments are nothing special but thought it might encourage other newbies to get their feet wet and have a go
BTW. I use the AXE091 Developement board as my test bed , its a god send as its already got everything on it like LEDS with series resistors , switches etc.
First thing I wanted to try was the new touch command .
A have a bunch of those ready made wires with pins on each end that you use with breadboards so I soldered one to a bit of PCB about an inch square
and plugged it into C.2 ( pin 1)
I did
When I ran it B0 had a value around 160 to 175
when I touched the back of the PCB the value went between 250 to 255
so far so good
So I then hooked up an LED to B.4 ( pin 10 ) and changed the code to
Great, it worked , when I touch the back of the PCB it lights the led , and it goes out when I let it go
Encouraged by this I wanted more , 2 touch contacts no less.
Being a lazy and impatient bugger I forgot to solder a bit of PCB to the second wire and used just the bit of insulated wire with a pin on each end
I put this one in B.3 ( pin 9) and the second LED into B.7 ( pin 13)
I altered the code
It was when I ran it and went to touch the second pcb touch pad I realized
that I had forgotten to solder a bit of PCB on , but what the heck, lets go for it . I touched the insulated wire and it worked just as well as the other one with PCB on it
I disconected the AXE027 usb programming lead so I could run it stand alone
( I wanted to take it downstairs to show the wife how her husband was close to taking over the world with his new found electronic skills), but thats when it all went wrong
After unplugging the USB lead one of the inputs stopped responding , strangely it was the one with the PCB touch pad , the plain wire still worked great. I relaced this touch pad with another plain wire and once again it all worked . I am not sure why this happens , my guess is my touch pad is too large and after unplugging the USB lead some how the capacitance is changing and knocking my calibration out of range , Maybe it will work better with Touch16 , I havent tried that yet.
Anyway, onwards and upwards, there is no stopping me now.
Multitasking
Making a second task is easy , Lets flash an LED
so LED to B.6 ( pin 12)
and run the code
The LED flashes as it should , but now how to make that program run at the same time as the earlier code . Wow thats easy , just add a start1: and start2: like this
Woot and Yay it works
The 3rd Led blinks away and the other two light every time I touch the two wires.
Its real easy, have a go
Don
BTW. I use the AXE091 Developement board as my test bed , its a god send as its already got everything on it like LEDS with series resistors , switches etc.
First thing I wanted to try was the new touch command .
A have a bunch of those ready made wires with pins on each end that you use with breadboards so I soldered one to a bit of PCB about an inch square
and plugged it into C.2 ( pin 1)
I did
Code:
Main:
Touch c.2 , B0
debug
pause 500
goto main
when I touched the back of the PCB the value went between 250 to 255
so far so good
So I then hooked up an LED to B.4 ( pin 10 ) and changed the code to
Code:
Main:
Touch c.2 , B0
if B0 > 200 then
High B.4
Else
Low B.4
endif
goto main
Great, it worked , when I touch the back of the PCB it lights the led , and it goes out when I let it go
Encouraged by this I wanted more , 2 touch contacts no less.
Being a lazy and impatient bugger I forgot to solder a bit of PCB to the second wire and used just the bit of insulated wire with a pin on each end
I put this one in B.3 ( pin 9) and the second LED into B.7 ( pin 13)
I altered the code
Code:
Main:
Touch c.2 , B0
if B0 > 200 then
High B.4
Else
Low B.4
endif
Touch B.3 , B1
if B1 > 200 then
High B.7
Else
Low B.7
endif
goto main
that I had forgotten to solder a bit of PCB on , but what the heck, lets go for it . I touched the insulated wire and it worked just as well as the other one with PCB on it
I disconected the AXE027 usb programming lead so I could run it stand alone
( I wanted to take it downstairs to show the wife how her husband was close to taking over the world with his new found electronic skills), but thats when it all went wrong
After unplugging the USB lead one of the inputs stopped responding , strangely it was the one with the PCB touch pad , the plain wire still worked great. I relaced this touch pad with another plain wire and once again it all worked . I am not sure why this happens , my guess is my touch pad is too large and after unplugging the USB lead some how the capacitance is changing and knocking my calibration out of range , Maybe it will work better with Touch16 , I havent tried that yet.
Anyway, onwards and upwards, there is no stopping me now.
Multitasking
Making a second task is easy , Lets flash an LED
so LED to B.6 ( pin 12)
and run the code
Code:
main2:
high b.6
pause 200
low b.6
pause 200
goto main2
Code:
Start1:
Main:
Touch c.2 , B0
if B0 > 200 then
High B.4
Else
Low B.4
endif
Touch B.3 , B1
if B1 > 200 then
High B.7
Else
Low B.7
endif
goto main
Start2:
main2:
high b.6
pause 200
low b.6
pause 200
goto main2
The 3rd Led blinks away and the other two light every time I touch the two wires.
Its real easy, have a go
Don