[chronojump] Terminal blinking controled by interruptions in the timer
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Terminal blinking controled by interruptions in the timer
- Date: Thu, 12 Aug 2021 17:25:25 +0000 (UTC)
commit a006a9f8ce72c94db68eaae652f86f35b69e3754
Author: Xavier Padullés <testing chronojump org>
Date: Mon Jun 21 21:54:02 2021 +0200
Terminal blinking controled by interruptions in the timer
arduino/lightChro/terminal/terminal.ino | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/arduino/lightChro/terminal/terminal.ino b/arduino/lightChro/terminal/terminal.ino
index 30124bb61..ba038f75f 100644
--- a/arduino/lightChro/terminal/terminal.ino
+++ b/arduino/lightChro/terminal/terminal.ino
@@ -57,7 +57,6 @@ struct sample_t
{
bool state; //State of the sensor
short int termNum; //Terminal number. Configured with the switches.
- //TODO: treat as a binary to activate each terminal separately
unsigned long int elapsedTime;
};
@@ -91,7 +90,7 @@ void setup(void)
//pot= getPALevel( ); //función que retorna potencia programada
Serial.begin(115200);
- printf_begin();
+ printf_begin(); //Used by radio.printDetails()
Serial.println(version);
@@ -177,18 +176,15 @@ void loop(void)
radio.setChannel(125);
// Serial.print("getChannel = ");
// Serial.println(radio.getChannel());
- delay(10);
bool en = radio.write( &sample, sample_size);
- if (en) {
- Serial.println("Sent OK");
- } else {
- Serial.println("Error sending");
- }
+// if (en) {
+// Serial.println("Sent OK");
+// } else {
+// Serial.println("Error sending");
+// }
// Serial.print("getChannel = ");
// Serial.println(radio.getChannel());
- buzzer_on;
- delay(25);
- buzzer_off;
+ beep(25);
flagint = LOW;
waitingSensor = false;
radio.setChannel(baseChannel + sample.termNum);
@@ -196,7 +192,6 @@ void loop(void)
// Serial.println("startListening()");
// Serial.print("getChannel = ");
// Serial.println(radio.getChannel());
- delay(10);
}
@@ -325,3 +320,16 @@ void serialEvent()
Serial.println(version);
}
}
+
+void beep(int duration)
+{
+ MsTimer2::set(duration, beepStop);
+ MsTimer2::start();
+ buzzer_on;
+}
+
+void beepStop(void)
+{
+ MsTimer2::stop();
+ buzzer_off;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]