lbt / captouch

Capacitative Sensor library for Spark
GNU Lesser General Public License v3.0
5 stars 8 forks source link

will not compile #1

Open whyameye opened 9 years ago

whyameye commented 9 years ago

Adding library and using test code produces this result in Spark web ide: In file included from ../inc/spark_wiring.h:29:0, from ../inc/application.h:29, from captouch/captouch.cpp:22: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ In file included from ../inc/spark_wiring.h:29:0, from ../inc/application.h:29, from captouch1.cpp:2: ../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]

warning "Defaulting to Release Build"

^ captouch1.cpp:10:7: error: ISO C++ forbids declaration of 'setup' with no type [-fpermissive] // and must be D0, D1, D2, D3, D4 A0, A1, A3, A4, A5, A6, A7 ^ captouch1.cpp: In function 'int setup()': captouch1.cpp:10:7: error: new declaration 'int setup()' In file included from ../inc/spark_wiring.h:33:0, from ../inc/application.h:29, from captouch1.cpp:2: ../inc/spark_utilities.h:169:6: error: ambiguates old declaration 'void setup()' void setup() attribute ((weak)); ^ captouch1.cpp:12:1: warning: no return statement in function returning non-void [-Wreturn-type] CapTouch Touch(D4, D5); ^ captouch1.cpp: At global scope: captouch1.cpp:14:6: error: ISO C++ forbids declaration of 'loop' with no type [-fpermissive] setup() { ^ captouch1.cpp: In function 'int loop()': captouch1.cpp:14:6: error: new declaration 'int loop()' In file included from ../inc/spark_wiring.h:33:0, from ../inc/application.h:29, from captouch1.cpp:2: ../inc/spark_utilities.h:170:6: error: ambiguates old declaration 'void loop()' void loop() attribute ((weak)); ^ captouch1.cpp:25:1: warning: no return statement in function returning non-void [-Wreturn-type] digitalWrite(D7, LOW); // LED off ^ make: *\ [captouch1.o] Error 1

Error: Could not compile. Please review your code.

blownupp commented 8 years ago

I can't seem to get this to compile either. Did you ever end up figuring it out? I'm on the verge of just buying an MPR121 instead of trying to get this to work in software...

whyameye commented 8 years ago

I ended up incorporating this code into my own code. You can see it as part of the code that is in my instructables: http://www.instructables.com/files/orig/FD8/DGC9/I95GTW70/FD8DGC9I95GTW70.ino

I found this software solution worked reasonably well. Since then though I have moved to a hardware solution which I think works more robustly: the Atmel AT42QT1010. I also tried the cheaper TTP223 and would not recommend it.

blownupp commented 8 years ago

Haha, it's funny actually - since I left that comment I've actually got my hands on BOTH of those! I haven't tried out the AT42 yet since I got it in SOT23 and don't have an adapter. I also picked up a couple of the breakout TTP223 modules and so far they appear to work fine for my needs. Thanks though, I'll check out the 'ible

whyameye commented 8 years ago

I was doing proximity as opposed to touch and the TTP223 was not as good at filtering, calibrating, hysteresis etc. as the AT42. I could address some of that in software. But what really did the TTP223 in for me is when it is left on for many hours. The sensor does not account for drift nor does it have a timeout behavior for if it sees touch for an extended time. This could again be perhaps addressed to some degree in software by resetting it occasionally, but in the end I didn't think it was worth all the hackiness when the AT42 works great without any problems.

blownupp commented 8 years ago

Good to know, thanks for getting back to me!

Here-Be-Dragons commented 8 years ago

The example code was missing declarations. I have put through a pull request to @lbt that incorporates these fixes. #3

steeley commented 7 years ago

Anyone tried this on a Photon? Compiles(just needed to set LED to D7) but does nothing when I tried it.

Here-Be-Dragons commented 7 years ago

I can confirm it does work great on the photon. Do you have a high-value resistor between the two selected pins? (I have used 1Mohm to 10Mohm). I've also found it works better where it is warmer, or potentially in places with higher humidity.

On Dec 24, 2016 3:54 PM, "steeley" notifications@github.com wrote:

Anyone tried this on a Photon? Compiles(just needed to set LED to D7) but does nothing when I tried it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lbt/captouch/issues/1#issuecomment-269100019, or mute the thread https://github.com/notifications/unsubscribe-auth/APQ8X1emrqEwkHJebJ_h2-SQC4DL--yxks5rLYZ7gaJpZM4C_gxt .

steeley commented 7 years ago

thanks for the info... Yes 4m7 resistor across pins. Code as per your example but with D7 for LED. Does nothing when touched. However... if I send touchEvent to the serial terminal I can see an event. it just doesn't fire the LED. Although loading a 'blink' test does. Very odd. Also, Can you set the sensitivity in software?

Here-Be-Dragons commented 7 years ago

Are you able to verify the LED works via another sketch, or do a console debug for the value returned from the touch library?

On Sat, Dec 24, 2016 at 4:10 PM, steeley notifications@github.com wrote:

thanks for the info... Yes 4m7 resistor across pins. Code as per your example but with D7 for LED. Does nothing when touched.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lbt/captouch/issues/1#issuecomment-269100593, or mute the thread https://github.com/notifications/unsubscribe-auth/APQ8Xyg_iUKFQ3fViSGpw2EWkEhdqDk7ks5rLYpfgaJpZM4C_gxt .

steeley commented 7 years ago

Seems ok now- I reflashed the firmware on the Photon to fix it. thanks,Ian

  From: Jerad Jacob <notifications@github.com>

To: lbt/captouch captouch@noreply.github.com Cc: steeley steeleymail@yahoo.co.uk; Comment comment@noreply.github.com Sent: Tuesday, 27 December 2016, 14:32 Subject: Re: [lbt/captouch] will not compile (#1)

Are you able to verify the LED works via another sketch, or do a console debug for the value returned from the touch library?

On Sat, Dec 24, 2016 at 4:10 PM, steeley notifications@github.com wrote:

thanks for the info... Yes 4m7 resistor across pins. Code as per your example but with D7 for LED. Does nothing when touched.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lbt/captouch/issues/1#issuecomment-269100593, or mute the thread https://github.com/notifications/unsubscribe-auth/APQ8Xyg_iUKFQ3fViSGpw2EWkEhdqDk7ks5rLYpfgaJpZM4C_gxt .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.