Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int led = 10;
- int x = 0;
- unsigned long tempo = 0;
- int meuDelay = 100;
- //-----------------------
- void setup()
- {
- pinMode(led, OUTPUT);
- Serial.begin(9600);
- tempo = millis() - meuDelay; // Ex: millis = 950, tempo = 850
- }
- //-----------------------
- void loop()
- {
- for (x = 0; x <= 255; x = x + 10)
- {
- if ((millis() - tempo) > 100) // Ex: millis = 951 millis() - tempo = 101
- {
- analogWrite(led, x);
- Serial.println(map(x, 0, 255, 0, 5));
- tempo = millis(); // Atualiza o valor de millis()
- //delay(100);
- }
- }
- //gostaria de substituir esse delay por um millis
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement