Questions tagged [loop]
123 questions
4
votes
5 answers
Simultaneous button reading?
I'm currently working on a project that requires that I simultanously check the state of two buttons. Each button HIGH state is assigned to one if loop. Here's the basic concept:
void loop() {
S1_State = digitalRead(S1_Pin);
S2_State =…
oh double-you oh
- 43
- 1
- 4
2
votes
1 answer
Wifi strength Automation . Help. Noobie here
#include
const char *SSID = "mr_lazy_boei";
const char *pass = "usalusal";
WiFiClient client;
// Relay pin number
int ignition=2;
int self=0;
// Return RSSI(Received Signal Strength Indicator) or 0 if target SSID not…
Mohd Usal
- 21
- 3
2
votes
2 answers
put_index = (put_index + 1) % 100;
Can someone interpret the code in the Title line for me? Specifically the function of the "%" sign? It is a line having to do with a 100 element circular buffer.
Ray Russell
- 21
- 1
1
vote
0 answers
My circuit is being goofy with regards to my PIR sensor
Here is the code I've written so far. I am making a circuit with a couple of motors and 3 sensors. My plan is for the PIR Motion sensor, distance sensor, and photoresistor to tell the motors to stop when they're triggered. When I set the if…
Guest
- 11
- 1
1
vote
0 answers
Does not execute code on loop;only run code of set up
only display this:
ARDUMOTIVE
ArduinoBased
compassn.Compass
Michalis Vas.
nothing else. I tried another Arduino Uno, Mega, Nano, but execute only set up. Display is working.No compiler errors.Sketch upload it with out errors!!
i found here…
Andreasmon
- 11
- 2
0
votes
1 answer
I have three pushbuttons where only one can be pushed at a time and want to set a variable for this. How?
Basically I have three push buttons that correspond to pins 1 to 3 and want to set an efficient code that sets a certain variable into the index whose digitalRead is equal to one. Let us assume that only one button can be pressed at a time.
void…
AndroidV11
- 157
- 5
0
votes
1 answer
Stuck in While loop!
I am using 4 LDR To track the sun for solar panels. Not using servos, but linear actuators(a little irrelevant but just to give scope)
my code gets stuck in this while loop as soon as it enters it, even tho the conditions are changed to break the…
Omasín
- 25
- 4
0
votes
1 answer
What features of the Arduino framework will fail if I use my own infinite loop in favor of the standard loop()?
I have a strong urge to replace the framework-provided loop() function with my own like so:
__attribute__((always_inline)) inline void fastLoop()
{
}
void setup()
{
// Performing setup here...
Serial.begin(115200);
// Now looping
…
Violet Giraffe
- 113
- 1
- 1
- 7
0
votes
2 answers
Blinking LED's at changing rate
I am trying to blink two LED's, starting at slow rate then increasing to fast s follows: 1 on, 1&2 on, 2 on, 1&2 on, 1 on, etc. The blinks go through the loop twice then speed up and repeat until both are on continuously. Then I want LED's 3 & 4 to…
JBrown
- 3
- 2
-1
votes
1 answer
Exit from for function after detecting obstacles
#include
int red = 13;
int green = 12;
int blue = 11;
int trigger = 9;
int echo = 8;
int halt;
void setup(){
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
pinMode(trigger, OUTPUT);
pinMode(echo, INPUT);
…
tommy
- 29
- 6