Questions tagged [sketch]

A sketch is compiled code that is uploaded to an Arduino board.

Filter by
Sorted by
Tagged with
1
vote
1answer
120 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(...
3
votes
2answers
121 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
1answer
34 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; ...
0
votes
1answer
58 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
1answer
71 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
0answers
134 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
1answer
114 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
1answer
62 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 ...
0
votes
0answers
35 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
2answers
101 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 ...
0
votes
1answer
34 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%...
0
votes
1answer
41 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
2answers
71 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
1answer
65 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> #...
0
votes
2answers
45 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
1answer
56 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 ...
0
votes
1answer
21 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
1answer
109 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....
0
votes
1answer
156 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
0answers
32 views

I'm coding 3 DC Motors to a Mega2560 Arduino (With motor sheild) and an error popped up saying DC_Motor.h:NO file or dictionary,even tho its correct? [duplicate]

heres my code reduced to minimum */ #include <DC_Motor.h> void setup() { } void loop() { } heres the error- /tmp/982713958/Animated_snowman_M1_M2_Arduino/Animated_snowman_M1_M2_Arduino.ino:...
0
votes
2answers
64 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 ...
0
votes
0answers
47 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
1answer
21 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 ...
1
vote
0answers
76 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
1answer
115 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
2answers
53 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 ...
0
votes
2answers
86 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 ...
0
votes
0answers
10 views

error in uploading code to arduino uno r3 [duplicate]

i bought genuino uno uno r3. installed ide on win 10 IDE version 1.8.9.few days ago it was working fine.two days ago it stoped uploading code with error.. "Arduino: 1.8.9 (Windows 10), Board: "...
0
votes
1answer
66 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
3answers
147 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
1answer
232 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
2answers
68 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 ...
0
votes
1answer
100 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
1answer
506 views

How Programing the nodeMCU Through OTA using GPRS?

How Programming the nodeMCU Through OTA using GPRS? Hi Everyone I need big help. Actually, I m using NodemCU one of my project. the setup in Remote location, that place dont have a wifi option so I ...
2
votes
3answers
482 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
1answer
64 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 ...
0
votes
1answer
1k views

Arduino Nano 3.0 CH340G clone cannot upload sketch from Arduino IDE [duplicate]

I connected my brand new Arduino Nano 3.0 clone with CH340G and installed the drivers. It detects in Device Manager as USB-SERIAL CH340 (COM6). Under the Tools menu, i selected the correct board, the ...
0
votes
2answers
207 views

Interrupt triggering using DHT-11

I am new at arduino. I want to write a sketch that would print the message if the temperature grows greater than 30 C. Here is my sketch can you please tell me what's wrong with it #include "DHT.h" #...
0
votes
1answer
126 views

millis() replace delay() question

// each "event" (LED) gets their own tracking variable unsigned long previousMillisLED12=0; unsigned long previousMillisLED13=0; unsigned long previousMillisLED3=0; // different intervals for each ...
0
votes
1answer
64 views

Please explain the void loop() section of the sketch

#include <VirtualWire.h> int PWMB = 5; //Speed control void setup(){ Serial.begin(9600); //receiver setup vw_set_rx_pin(2); vw_set_ptt_inverted(true); vw_setup(2000); ...
0
votes
1answer
66 views

please explain the sketch attached

Sorry about a newbie. 1. what mening of: if(Xstr[XstrLength-1] != '|'){ Xstr[XstrLength] = '|'; Xstr[XstrLength+1] = '\0'; the setup: char Xstr[60]; what means? and then: itoa(Yint,...
1
vote
1answer
347 views

Arduino New Optiboot Bootloader on custom ATMega328p board, ATMEL Studio and AVRdude [closed]

I am about to ask a kind of complex question due to the number of system parts involved and the system architecture I am planning to use. First of all I have a tiny bit of experience with the Arduino ...
0
votes
1answer
120 views

The sketch burned two H Bridges, need help to find out how to modify

This is Arduino RC control car, the sketch tested good in a small motor, but burned two 60A drivers when put into 24V,500W motors, need help to find out whats wrong? #include <VirtualWire.h> //...
0
votes
0answers
12 views

Problem with uploading sketch [duplicate]

Arduino: 1.8.9 Hourly Build 2019/02/04 10:12 (Mac OS X), Board: "Arduino/Genuino Uno" Sketch uses 2078 bytes (6%) of program storage space. Maximum is 32256 bytes. Global variables use 189 bytes (9%) ...
0
votes
1answer
57 views

Why Would Declaring a Global Variable Change How An Unrelated Conditional is Evaluated?

Here is my entire sketch. This is my first Arduino project. I included all of it because I don't know what's relevant. I am printing out to a 4-digit 7 segment display. To do that I use sprintf to ...
0
votes
1answer
91 views

LCD shows output without pressing the sensor

#include<LiquidCrystal.h> LiquidCrystal lcd(13,12,11,10,9,8); #define vibrate_sense 7 char str[70]; char *test="$GPGGA"; char logitude[10]; char latitude[10]; int i,j,k; int temp; //int ...
0
votes
0answers
369 views

Ethernet Shield - Not Working Properly Always

I'm working on a school project and using Arduino Uno. The basic working method for the project is as follows: Read temperature from LM-35. Read CO2 level in air using MH-Z14A. Upload data to server ...
1
vote
1answer
227 views

New code results in audio noise

I am working on a circuit that can record audio to an SD when a switch is HIGH and stop recording when the switch is LOW. I am using the TMRpcm library. I previously had an issue solved on these two ...
0
votes
1answer
79 views

What is the easiest way to count how many global variables are in your sketch code?

I have a fairly complicated sketch with about 1k lines of code. I should also say that I'm not a programmer by trade... As I go over my code and try to make it more efficient, it'd be good to know ...
1
vote
2answers
340 views

What exactly does the Arduino preprocessor do?

Arduino claims to be a "language," not just an "application framework," and Arduino files have their own extension, .ino. The language is obviously C++, but not quite. My understanding is that ...

1
2 3 4 5 6