Questions tagged [sketch]
A sketch is compiled code that is uploaded to an Arduino board.
258
questions
1
vote
0
answers
92
views
display.begin(); function breaks working code
I've been setting up a system using an Arduino Uno board that reads from both an Adafruit MPU6050 6-way gyroscope and accelerometer and an Adafruit NAU7802 connected to a load sensor. I have code for ...
0
votes
1
answer
137
views
if statement does not work with fraction, but works with decimal equivalent
I'm trying to trouble shoot a problem with my code and narrowed it down to my if statement not working with a fraction.
The below code does not work and returns 0
for(float i=0; i <= 1; i += .0001){...
1
vote
1
answer
122
views
DHT11 temperature and humidity sensor Code
I’ve got a question about this code I’ve attached please- would it be correct to read it like this:
After defining the variable temperature and humidity and assigning measurement_timestamp to millis(),...
1
vote
2
answers
108
views
Stoplight Simulator - White LED not turning on with button press [closed]
I am working on a relatively simple stoplight simulator that uses four LEDs - red, green, yellow, and white - in addition to a button. The 3 colored stoplight LEDs cycle as a real stoplight would. If ...
-1
votes
1
answer
104
views
How to write a program to do 2 different loop | Task?
I wanna write a program for rc-plane navigation
The plane must navigate to 2 waypoints waypoint_1 & waypoint_2
When it reaches to waypoint_1 (with miss-distance =< 5) then navigate to ...
2
votes
2
answers
169
views
How to unload a sketch
I've loaded a sketch onto Arduino using the Ardunio IDE and it works but when I press the reset button I realize it doesn't remove the program. Is there a way to unload the program? Why? Because when ...
0
votes
1
answer
139
views
How to get started with writing code for a Hall Effect sensor?
One of my biggest questions concerns coding a Hall effect sensor to find wheel speed with an arduino mega.
I’ve got an lcd in digital pins(7,8,9,10,11,12) and a Hall effect sensor in digital pin 2.
I ...
1
vote
1
answer
140
views
How to change variable/sketch through a GUI
Over the past few months, I've been working on a wearable computer mouse using an Arduino and a 9-dof sensor. Most of the sketch is complete, and works as expected.
Recently, I started investigating ...
1
vote
2
answers
173
views
Two servos for robot (head & chest) movement at different speeds at once
I have an Arduino Uno and two Hi-tec servos (HS-40 & 5055 digital) that I'm using for a basic robot build. I'm trying to have one servo(HS-40) turn the head back and forth (left to right) slightly ...
1
vote
0
answers
25
views
I have 2 sketches with same RTC DS1307 but when I combine the 2 sketches it gives errors [duplicate]
I have 2 sketches one is pixel clock with RTC ds 1307 and the other is 7 Segment with DHT 11, I want to merge the two into one but it is giving errors for rtc.
sketch for pixel clock
#include <Wire....
1
vote
0
answers
48
views
Why does the LED state behave differently?
I wanted the sensor to be high when I press the button, but when DigitalRead does low, the LED turns on, when it does high, the LED goes off.
Whereas when the digitalRead is high, isn't it supposed to ...
1
vote
0
answers
192
views
Http Client requests
I am working on a project where the ESP 8266 sends a very long string about 3000 chas over http as client. Likewise sensor data are determined. The loop repeats itself every 250ms. Now I noticed that ...
1
vote
0
answers
82
views
Aurdino EMG sensors and servos?
I'm new here and to the aurdino.
I'm building a 3D printed robotic arm controlled by a EMG sensor. I purchased a V3 EMG board and leads on Aliexpress. Here's a list of the things I've purchase for ...
5
votes
3
answers
2k
views
Using Arduino as a standalone compiler
I mostly program in C/C++ so I conviniently have a GCC compiler for all my compilations. I was wondering if there is a special compiler for Arduino that can be used just like the GCC Compiler? Because ...
-1
votes
1
answer
2k
views
Standard deviation and variance of an array of numbers
Looking for a simple way to get the variance of an array of numbers,
that will compile with the Arduino compiler.
Something like this c#:
static float variance(double []a, int n)
{
// Compute mean ...
-1
votes
1
answer
142
views
How do I fix my code on the Arduino IDE App?
//www.elegoo.com
#include <RobotIRremote.h>
#define RECV_PIN 12 //Infrared signal receiving pin
#define LED 13 //define LED pin
#define L 16738455
#define ...
1
vote
1
answer
147
views
I want to create 10 levels with one button but this code shows only level 1?
#include <Adafruit_NeoPixel.h>
const int PIN = 4;
const int NUMPIXELS = 10;
const int BUTTONPIN = 6;
int buttonState = 0;
int PINState = 0;
int level = 1;
int dt = 100;
Adafruit_NeoPixel pixels(...
4
votes
2
answers
1k
views
Can Arduino Sketch be used for production
There are lot of device support with the help of Boards Manager today and is on going in Arduino IDE.
So I am curious to know about can one use those for production purpose. Or it is recommended for ...
2
votes
1
answer
44
views
Leds become dimmer after they reach a certain brightness, why?
Even if I don't use buttons and I do an automated thing that makes the led brighter(Even the non-rgb one)after sometime it resets itself to a dimmer light, why?*
int Gled = 5;
int Bled = 6;
int Rv;
...
2
votes
2
answers
1k
views
Can't Upload Sketches to Arduino Nano Every
first-time builder here. I just got my Arduino Nano Every in the mail from Mouser, and I'm trying to upload a modified version of the blink example to my new brand-new board. However, every time I ...
2
votes
1
answer
332
views
Branchless programing on arduino?
So I've been looking into branchless programming to speed up code and I'm curious as to how exactly Arduino (or rather atmega328) actually reads machine instructions. Does it have a memory cache or ...
0
votes
1
answer
1k
views
Program Nano Every using UPDI port
I have and Arduino Nano and an Arduino Nano Every. I'm doing some experiments and trying to program the Nano Every from the Nano, using the UPDI port.
I'm using tutorials like this one that does the ...
0
votes
1
answer
1k
views
nRF24L01 - Measuring distance using time elapsed
For school usage, my team and I are working on a wristband that will alert the user if they are too close to another wristband (for social distancing). The problem is measuring distance using radio ...
0
votes
1
answer
899
views
Cannot send any UDP packets from ESP8266 Wemos D1
I am attempting to send sensor data from a battery-powered device using UDP. The goal is to send a datagram immediately after the wifi station awakes from sleep then immediately go back to sleep after ...
1
vote
0
answers
220
views
How do i efficiently write this code for PS2 controller to USB convertion sketch for Arduino Pro Micro?
I am really new to coding and building stuff, so forgive me if it is anything offensive.i have been trying to convert my PS2 dualshock controller to USB using arduino. there is a library called ps2x ...
-2
votes
2
answers
194
views
Use an LDR to run a sketch
This may sound like a simple question but I have tried to find the right solution but all I find is the usual make an led blink and even I can code that nugget
I am quite new to programming arduino ...
1
vote
1
answer
57
views
Ardiuno DUE board. Sketch uploading Error
I am working on Arduino UDE board in Ubuntu 18.04. I've followed following link tutorial.
https://www.arduino.cc/en/Guide/ArduinoDue#:~:text=Use%20your%20Arduino%20Due%20on%20the%20Arduino%20Desktop%...
1
vote
1
answer
767
views
Master Reader/Slave Sender with Distance Sensor
I am currently working on a project and want to transmit the information from a distance sensor from one arduino the another, but what i receive in the master board are not the correct measurements.
...
1
vote
2
answers
170
views
Bike Gear Indicator Coding Problem
Lack of practice I forgot many function of C & C++...
Can anyone help me with this coding Please...
I think this is The Main coding:
Topic: Gear indicator
I first found this, Gear_Indicator_Raw
...
0
votes
1
answer
2k
views
Getting error invalid conversion from 'const char*' to 'const uint8_t*
I have written this sketch, and I am trying to populate the array of wifi hotspots to set the value in html select using javascript dynamically.
#include <Arduino.h>
#include <Hash.h>
#...
1
vote
2
answers
99
views
Runtime compilation
I want to compile a sketch on Arduino Uno, while Arduino is running and not connected to anything else, and then run the compiled sketch automatically.
Is this feasible?
How?
0
votes
1
answer
312
views
Controllino Mega and Fatek HMI
I have a setup that controls the rotation of two stepper motor using Arduino UNO, HBS860H stepper drivers, 4X4 keypad and LCD screen. I have replaced the Arduino Uno by a Controllino Mega and it works ...
1
vote
1
answer
65
views
Update class attribute with attachInterrupt
I want to refactor this code
/*
YF‐ S201 Water Flow Sensor
Water Flow Sensor output processed to read in litres/hour
Adaptation Courtesy: www.hobbytronics.co.uk
*/
volatile int flow_frequency; // ...
0
votes
1
answer
636
views
Im having another problem with my code the error is "redefinition of 'AF_DCMotor motor'? [duplicate]
Heres the code
#include <AFMotor.h>
AF_DCMotor motor(1, MOTOR12_8KHZ);
AF_DCMotor motor(2, MOTOR12_8KHZ);
AF_DCMotor motor(3, MOTOR34_1KHZ);
void setup() {
Serial.begin(9600);
Serial....
1
vote
2
answers
1k
views
serial is print twice?
I have a problem , when send 1 or 0 by Bluetooth module the serial monitor print two time (RECEIVED SMS) . what's the wrong ?
This is my code :
char BluetoothData = 0 ;
void setup() {
// ...
0
votes
2
answers
449
views
Check if the board is in sleep mode
I'm using seep sleep mode with UNO with a simple sketch that turning on an LED and then goes to sleep. as far as the ATmega328p datasheet in sleep mode part showing the wake up sources and deactivated ...
1
vote
0
answers
92
views
Arduino Sketch Crashes in working procedure when adding extra call
I am trying to drive a couple of motors to make a car.
I successfully wrote some code then tidied it up to procedurise it and it just kept crashing.
I've put some debug code in and narrowed it down a ...
1
vote
1
answer
97
views
Help, I want to turn relay constantly on until a difference is detected, but triggered only one instead
Help, I want to use arduino to control relay for electricity, i get data from a sensor and when a value is detected it should be constantly on until another detection triggered again, i can get the ...
2
votes
0
answers
175
views
Arduino uno wifi rev2 error compiling sketch to board [duplicate]
I'm having an irritating situation with my Arduino Uno wifi rev2 board.
I made an installation with an LCD, keypad and little servo motor. I first wrote the code for my regular Arduino Uno and ...
0
votes
1
answer
308
views
How should I customize UIPEthernet constants?
I am using UIPEthernet to get an Arduino Nano to drive an ENC28J60 Ethernet Shield for a UDP-based application. I'm customizing a number of its #define parameters to change default settings to save ...
0
votes
2
answers
127
views
NeoMatrix Button Troubles
I am creating a 20x15 LED Matrix using and Arduino Nano. My goal is to switch between different "scenes," if you will, using 4 buttons (I just need to run different code to make it display something ...
1
vote
2
answers
237
views
How can I upload a sketch remotely from a distant location onto an arduino that is power by a battery
Of course after developing a success full embedded product the next step would be making upgrades to compete favorably with new products in the market. Well making upgrades would require making ...
1
vote
1
answer
122
views
Why doesn't data return when I use Sim808 http request
Why is it that when i use this code for http request on DFRobot_sim808 , I get 'fetch over' message, that means that no data is being returned?
char strings:
char http_cmd[] = " HTTP/1.0\r\n"
...
1
vote
3
answers
280
views
Arduino Nano - Strange problems
Update:
The arduino works only when I connect 3.3v to reset pin. And I successfully uploaded a sketch but it stops when I disconnect 3.3v and reset.
Update 2:
-- Removed --
Update 3:
Its working ...
-1
votes
1
answer
674
views
Is low memory warning based on a fixed number of on the actual sketch?
I have the following output of my sketch for the Arduino Mega so far:
Sketch uses 25020 bytes (9%) of program storage space. Maximum is 253952 bytes.
Global variables use 6919 bytes (84%) of dynamic ...
0
votes
2
answers
77
views
Why does this take more byte?
I am only replacing a portion of my code where I want to use the first method but as you can see it is making my sketch size little bigger
//if(iBPM >= 40 || iBPM <= 170 )
{
char ...
1
vote
1
answer
189
views
Please help me combine the two codes for DHT11 and SW-420 Vibration sensor for arduino in one program [duplicate]
The following is the code used for DHT11 Temperature and Humidity sensor:
#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 5, 0, 1, 2, 3);
byte degree_symbol[8] =
{
...
1
vote
1
answer
1k
views
How to program the nodeMCU through OTA using GPRS?
I'm using a NodeMCU in one of my projects. The setup is in a remote location. That place doesn't have WiFi so I'm using GPRS (GSM SIM800V) for sensor data collection to my server. Right now I need to ...
1
vote
2
answers
521
views
What is wrong with my code? RGB potentiometer
Arduino programming has been a huge learning curve for me and I am trying to create a project with an rgb that's color is determined by a potentiometer. To where the further I turn it, the further ...
0
votes
1
answer
100
views
Help with coding Arduino Nano to run fan through slide switch at specific intervals
I’m trying to use Arduino Nano to run my 5 V PC fan, which, I know it sounds crazy, it’ll be mounted on a piece of Tupperware that’ll control the airflow through it via the fan. However I have no ...