What if I just use 1 sensor ? Is this the same ?
What if I just use 1 sensor ? Is this the same ?
And what is the role of these resistors ?
1,2,3,4,5,6,100, 100 000 sensor solution is the same.
Rough explanation, your body act as a capacitor between the sensor and the circuit ground. By the time the Pin is low, if you add an small capacitance on the pin, set the pin high the read then pin, the pin will read low because the capacitor haven't got time to "charge"... period. simple. Really old way to do it.
You can also do it with a spare CMOS input,Darlington transistor, FET, OpAmp... etc etc etc.
Plug your home theater sound system, set it to line input, crank the volume to the max, insert a needle in the RCA center pin woohoo you got a signal!!!
mTouch use ADC reading, probably more accurate and versatile... no real extra parts.... on both solution, you need a fairly good PCB design.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hey mister,
I almost understood what you did however there are some places I still don't really understand:
data @3,3,0,2,1 ' table to convert 'Sensor' variable result to according
' LED blink. See Result list bellow
=> I don't really understand this code? what is the meaning of value: 3,3,0,2,1 ? is this loop variable will get this value ?
' 4. Keep only GPIO<2:0> bits => what is the meaning of keep only GPIO<2:0> bits ? Does it mean that we just read the value of GPIO bits?
repeat
Generator = 1 ' enable sensor power
Sensor = GPIO ' read sensor
Generator = 0 ' disable sensor power => this is send low level right ?
Sensor = Sensor & 7 ' keep only Sensor bits => don't understand thisis this the comparison ? and what value will sensor get?
'
until Sensor != 7 ' redo the test untill one sensor is touch
'
' Now we will flash an LED to confirm wich sensor has been touch
' GPIO.0 => 1 Blink
' GPIO.1 => 2 Blink
' GPIO.2 => 3 Blink
'
read sensor,loop ' convert result to blink
repeat
LED = 1
PAUSE 200
lED = 0
PAUSE 200
loop = loop - 1
until loop = 0
=> if in this case I use 220v light bulb and I want it lights until we touch again what should I do ?
Hey is this code true for the 220V light bulb ? I don't mention the syntax just the algorithm.(I familiar with C language )
Code:While (1) do 'this creates an infinity loop' { repeat Generator = 1 ' enable sensor power Sensor = GPIO ' read sensor Generator = 0 ' disable sensor power Sensor = Sensor & 7 ' keep only Sensor bits until Sensor != 7 ' ' If the light bulb is lighting we will turn off it when we touch ' else we will turn on. if (LED == 1) LED = 0; else if (LED == 0) LED = 1; }
Nobody helps me check the code ?![]()
If you understand C, I would suggest to look for answers in C forums.
Here we all do Basic and specifically Melabs Pic Basic.
Ioannis
Bookmarks