first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

42
photoresistor/photoresistor.ino Executable file
View File

@@ -0,0 +1,42 @@
#include <DigiUSB.h>
/*
Basic Analogue Input Control - PhotoResistor Input
This example reads an analogue value from analogue in pin 1 and then compares this to a set point.
If the set point is threshold is crossed, the LED on digital pin 7 is turned on/off.
Author: David M. Auld
Date: 9th October 2009
*/
int photoIn = 0; // photoresistor on Analogue Pin 1
int aiValue = 0; // input value
int setPoint = 350; // Trigger value
void setup() {
DigiUSB.begin();
}
void wait_till_newline() {
// when there are no characters to read, or the character isn't a newline
while (!DigiUSB.available() || DigiUSB.read() != '\n') {
// refresh the usb port
DigiUSB.refresh();
}
}
void loop() {
//delay(2000);
// DigiUSB.begin();
wait_till_newline();
//DigiUSB.refresh();
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
aiValue = analogRead(photoIn); // Read the analogue input value
DigiUSB.print("##");
DigiUSB.print(aiValue);
DigiUSB.print("@@");
return;
}