I am facing error when i run below code. in this code i use scheduler, I run 2 loops, in the first loop blinking RGB LED and in the second loop just print some name. if RGB LED blinking code not used, both loop run but when i used LED code, program not upload and error occur.
// Include Scheduler since we want to manage multiple tasks.
#include <Scheduler.h>
#include <FastLED.h>
#define LED_PIN 10
#define NUM_LEDS 1
CRGB leds[NUM_LEDS];
//int led2 = 12;
//int led3 = 11;
void setup() {
Serial.begin(9600);
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
// Add "loop2" and "loop3" to scheduling.
// "loop" is always started by default.
Scheduler.startLoop(loop2);
}
// Task no.1: blink LED with 1 second delay.
void loop() {
Serial.print("hiii");
leds[0] = CRGB(255, 0, 0);
FastLED.show();
delay(500);
leds[0] = CRGB(0, 255, 0);
FastLED.show();
delay(500);
leds[0] = CRGB(0, 0, 255);
FastLED.show();
delay(500);
}
void loop2(){
Serial.print("Simtest");
}
UKHeliBob:
Please post the full error message and details of which Arduino board you are using
"Error- Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload." This error occurs only when I used scheduler with LED blinking. if i run 2 void loops without LED code it works properly.
OK, sorry but I think this FreeRTOS library can't be used with your board.
I was going to suggest to use this one (TaskScheduler) : which on did you choose?
lesept:
OK, sorry but I think this FreeRTOS library can't be used with your board.
I was going to suggest to use this one (TaskScheduler) : which on did you choose?
Thank You very much, sir. You give me an idea related to my problem, even i don't know its error due to library conflict.
sir, Now i am looking for controlling delay time using exe.
for changing delay I don't want each time I open my sketch. simply i want user configurable delay time.
amitshishodia:
for changing delay I don't want each time I open my sketch. simply i want user configurable delay time.
Do you mean the value 500 in delay(500) ?
Well you need some sort of memory to store it.
But a more simple way would be to use a potentiometer (it's a kind of memory ). You read the voltage value and assign the duration according to this value.
// Read analog value from potentiometer middle pin
int value=analogRead(potPin)
// Map analog values 0-1024 to delay (here between 0 and 2000 ms)
int duration= map(value, 0, 1023, 0, 2000);
delay (duration);
Whenever the board is switched off and switched on again, if the potentiometer didn't move, the duration value should remain the same (or roughly the same). And it's user configurable.
lesept:
Whenever the board is switched off and switched on again, if the potentiometer didn't move, the duration value should remain the same (or roughly the same). And it's user-configurable.
Sir its good idea, but i make one device for vibration measurement in this device I cant use a potentiometer. i just want to connect my device to my computer with the help of some exe(app/software) change delay time without open Arduino ide. and again disconnected the device from the computer. and start acquiring data from new delay time.