First thanks for making the cool 18M2, just what i need for some projekts
PICAXE181 Touch Sensor Demo
I got this test board and it is working well, but just one thing missing that maybe will be a good idea if you some day need to change it.
A small potmeter on a ADC input so you better can play with fine tuning the sensetive of the touch..... just a idea.
And for sharing here is my code for the PICAXE181 board and it is self calibrating each touch pad at startup and seem to work well.
Tooms
PICAXE181 Touch Sensor Demo
I got this test board and it is working well, but just one thing missing that maybe will be a good idea if you some day need to change it.
A small potmeter on a ADC input so you better can play with fine tuning the sensetive of the touch..... just a idea.
And for sharing here is my code for the PICAXE181 board and it is self calibrating each touch pad at startup and seem to work well.
Code:
; *******************************
; ***** Sample Header File *****
; *******************************
; Filename: PICAXE181_selfcalib_touch_1.bas
; Date: Today
; File Version: 0.0.0.1.beta
; Written by: Tooms
; Function: selfcalib touch 1
; Last Revision: This one
; Target PICAXE: 18M2
; *******************************
Init:
'Set all led high
high B.4
high B.5
high B.6
high B.7
'Calc baseline for C.0 to W10
for B18 = 1 to 20
touch16 C.0, W8
Let W10 = W8 / 20 + W10
next
LOW B.4
'Calc baseline for C.1 to W11
for B18 = 1 to 20
touch16 C.1, W8
Let W11 = W8 / 20 + W11
next
LOW B.5
'Calc baseline for C.2 to W12
for B18 = 1 to 20
touch16 C.2, W8
Let W12 = W8 / 20 + W12
next
LOW B.6
'Calc baseline for B.3 to W13
for B18 = 1 to 20
touch16 B.3, W8
Let W13 = W8 / 20 + W13
next
LOW B.7
'set detect value based on baseline + add-value
'The last value in each line controlle how sensetive it is and 500 seem good value
Let W10 = W10 + 500
Let W11 = W11 + 500
Let W12 = W12 + 500
Let W13 = W13 + 500
Main:
'Touch C.0
touch16 C.0, W0
if W0 > W10 then
high B.4
else
Low B.4
end if
'Touch C.1
touch16 C.1, W1
if W1 > W11 then
high B.5
else
Low B.5
end if
'Touch C.2
touch16 C.2, W2
if W2 > W12 then
high B.6
else
Low B.6
end if
'Touch B.3
touch16 B.3, W3
if W3 > W13 then
high B.7
else
Low B.7
end if
'Debug
'pause 500
goto main
Tooms