Capacitive touch senosor example
							parent
							
								
									32c620aec6
								
							
						
					
					
						commit
						2fd8eb06bb
					
				
											
												Binary file not shown.
											
										
									
								| After Width: | Height: | Size: 173 KiB | 
| @ -1,24 +1,30 @@ | |||||||
|  | /*
 | ||||||
|  | This is a simple program that reads the capacitive touch sensor on pin4. If it is a low enough value | ||||||
|  | it will light up the builtin LED. | ||||||
|  | */ | ||||||
| #include <Arduino.h> | #include <Arduino.h> | ||||||
| #include <foo.h> |  | ||||||
| 
 | 
 | ||||||
| #define LED_BUILTIN 2 | #define LED_BUILTIN 2 | ||||||
| int delayTime = 1000; | int delayTime = 100; | ||||||
|  | int read_value = 100; | ||||||
| 
 | 
 | ||||||
| void setup() | void setup() | ||||||
| { | { | ||||||
|   // put your setup code here, to run once:
 |  | ||||||
|   pinMode(LED_BUILTIN, OUTPUT); |   pinMode(LED_BUILTIN, OUTPUT); | ||||||
|   Serial.begin(115200); |   Serial.begin(115200); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void loop() | void loop() | ||||||
| { | { | ||||||
|   // put your main code here, to run repeatedly:
 |   read_value = touchRead(4); | ||||||
|   Serial.println("Starting loop"); |   Serial.println(touchRead(4)); | ||||||
|  |   if (read_value < 10) | ||||||
|  |   { | ||||||
|     digitalWrite(LED_BUILTIN, HIGH); |     digitalWrite(LED_BUILTIN, HIGH); | ||||||
|   delay(delayTime); |   } | ||||||
|  |   else | ||||||
|  |   { | ||||||
|     digitalWrite(LED_BUILTIN, LOW); |     digitalWrite(LED_BUILTIN, LOW); | ||||||
|   Serial.println("Turning off LED"); |   } | ||||||
|   printf("This is main3.cpp!\n"); |  | ||||||
|   delay(delayTime); |   delay(delayTime); | ||||||
| } | } | ||||||
					Loading…
					
					
				
		Reference in New Issue
	
	 Drew Bednar
						Drew Bednar