@@ -109,6 +109,29 @@ const int pwmMax = pow(2,pwmresolution)-1;
109109 int8_t recognition_enabled = 0 ;
110110#endif
111111
112+ // Notification LED
113+ void flashLED (int flashtime) {
114+ #ifdef LED_PIN // If we have it; flash it.
115+ digitalWrite (LED_PIN, LED_ON); // On at full power.
116+ delay (flashtime); // delay
117+ digitalWrite (LED_PIN, LED_OFF); // turn Off
118+ #else
119+ return ; // No notifcation LED, do nothing, no delay
120+ #endif
121+ }
122+
123+ // Lamp Control
124+ void setLamp (int newVal) {
125+ if (newVal != -1 ) {
126+ // Apply a logarithmic function to the scale.
127+ int brightness = round ((pow (2 ,(1 +(newVal*0.02 )))-2 )/6 *pwmMax);
128+ ledcWrite (lampChannel, brightness);
129+ Serial.print (" Lamp: " );
130+ Serial.print (newVal);
131+ Serial.print (" %, pwm = " );
132+ Serial.println (brightness);
133+ }
134+ }
112135
113136void setup () {
114137 Serial.begin (115200 );
@@ -320,30 +343,6 @@ void setup() {
320343 Serial.printf (" \n Camera Ready!\n Use '%s' to connect\n\n " , httpURL);
321344}
322345
323- // Notification LED
324- void flashLED (int flashtime) {
325- #ifdef LED_PIN // If we have it; flash it.
326- digitalWrite (LED_PIN, LED_ON); // On at full power.
327- delay (flashtime); // delay
328- digitalWrite (LED_PIN, LED_OFF); // turn Off
329- #else
330- return ; // No notifcation LED, do nothing, no delay
331- #endif
332- }
333-
334- // Lamp Control
335- void setLamp (int newVal) {
336- if (newVal != -1 ) {
337- // Apply a logarithmic function to the scale.
338- int brightness = round ((pow (2 ,(1 +(newVal*0.02 )))-2 )/6 *pwmMax);
339- ledcWrite (lampChannel, brightness);
340- Serial.print (" Lamp: " );
341- Serial.print (newVal);
342- Serial.print (" %, pwm = " );
343- Serial.println (brightness);
344- }
345- }
346-
347346void loop () {
348347 // Just loop forever.
349348 // The stream and URI handler processes initiated by the startCameraServer() call at the
0 commit comments