Questions tagged [sketch]

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

Filter by
Sorted by
Tagged with
2
votes
6answers
1k views

Include Git tag (or SVN revision) in Arduino sketch?

Is there any way to get the current Git tag/commit identifier into an Arduino sketch binary? For normal desktop program development, you can pull some tricks with the Makefile (as pointed out in this ...
0
votes
1answer
2k views

Using MMA8451 accelerometer to count steps [duplicate]

I'm trying to use an Adafruit MMA8451 accelerometer to create a pedometer-type device that counts steps. I'd like to initiate a counter that says "if the x-axis readout is > some threshold, add 1 to ...
0
votes
0answers
40 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 ...
0
votes
4answers
7k views

While loop not breaking

I'm trying to build a circuit that buzzes until a button is pressed, or it buzzes 5 times: void alarm() { int AlarmState = 0; //Just to get while loop going int count = 1; while(AlarmState==0) ...
0
votes
2answers
54 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
1answer
15 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
20 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
33 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
36 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
1answer
234 views

I have to reload Sketch every time I start my Yun

I am new to Arduino and IoT. I got my hands on a Yun and loaded a simple sketch to subscribe to a topic. I am receiving messages (I have set up a PHP script and broker on a server, which takes care of ...
0
votes
1answer
156 views

How to upload sketch from flash memory of nodemcu-V1.0?

I'm working with esp8266 nodemcu-v1.0 .Now we are using OTA but the module may be disconnected from wifi so we need to use 2G by GSM Module(using beside nodemcu) to receive our new sketch to be ...
1
vote
1answer
113 views

Will this sketch eventually fail because of integer limit issue?

I am a novice in Arduino programming and I'm setting up an Arduino controlled, underwater time-lapse camera to take a picture every 2 hours. It's going in the ocean for a month and I want to be sure ...
-1
votes
1answer
3k views

IOT-GA6 gsm module Arduino +CME error 58

I've recently bought a IOT-GA6 gsm module . I want to use it to send an mms but doesn't work. The SMS and call work. When I execute the void function (mms) the monitor shows the error message +CME ...
0
votes
1answer
3k views

Control multiple LEDs with multiple buttons

Problem 1: LED1 needs to be on only when button1 is held down. Right now it takes several presses to turn on and off and stays on. Problem 1: LEDs 2,3,4 do not turn off with buttons 2,3,4. They are ...
1
vote
3answers
5k views

Implement Visible Light communication using Arduino

I want to implement a simple VLC based communication system using two Arduinos and send messages/data/files between two PCs. For that I have a simple transmitter circuit with an LED on Tx side and a ...
1
vote
3answers
128 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 ...
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
56 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
1answer
324 views

When I turn on the servo it spins on its own before going to the right position and start the sketch

I can't get my head around this: when I turn the servo on it just spins on its own as if it's setting up, it goes to an angle superior to the one I want it to go. (Don't mind if it has to set up but ...
0
votes
1answer
57 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
63 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
82 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] = { ...
14
votes
2answers
24k views

Asynchronous function calls in Arduino sketch

In an Arduino sketch, is there a way to make asynchronous function calls within the loop? Like listening to requests through http server and process them in a non-blocking way.
1
vote
1answer
212 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 ...
3
votes
1answer
915 views

What is the Arduino Uno default sketch?

When I bought my Arduino Uno and connected it to my computer, I tried to make the simple blink circuit (before programming the Arduino) and suddenly the LED started blinking. Is the blink example the ...
-1
votes
3answers
282 views

Is there an open source compiler for Arduino Sketch codes?

I am working on a web app to program some nodeMCU devices that were flashed with the arduinoOTA library. http://esp8266.github.io/Arduino/versions/2.0.0/doc/ota_updates/ota_updates.html I tried the ...
2
votes
3answers
472 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
2answers
4k views

Unable to use Keyboard library with Arduino UNO even after changing the firmware

So I'm trying to use my UNO as an HID device. I followed this tutorial, flashed the firmware and got the UNO to be detected as an HID device. However, I am still getting the error 'Keyboard' not ...
0
votes
1answer
53 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
746 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
106 views

Run piece of code based on a feature

I am an engineering student completely new at using Arduino so my following question might be silly but still. I do not think you'll need to get the entire code so I am only going to expose the idea. ...
0
votes
2answers
114 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
100 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
58 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
62 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
230 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 ...
1
vote
1answer
358 views

Cannot obtain reading from meter (Modbus)

I have a system in which I am taking readings from a meter and processing it through an Arduino Nano. My code looks as follows: #include <SoftwareSerial.h> #define SerialControl 7 #define ...
0
votes
1answer
110 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> //...
17
votes
6answers
11k views

What happens if there is a runtime error?

What happens if there is a runtime error in a program? Will execution of the program just stop? Is there some way I get get the Arduino to tell me what the error is?
0
votes
1answer
87 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
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%) ...
46
votes
5answers
135k views

Is there any way to download a sketch from an Arduino?

I made a sketch, but then I lost it. However, I uploaded it to the Arduino before losing it. Is there any way I can get it back?
0
votes
1answer
48 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
0answers
276 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 ...
20
votes
13answers
86k views

Arduino Nano uploading gives error: avrdude: stk500_recv(): programmer is not responding

I have a Arduino Nano (Sainsmart) that I'm trying to upload a sketch to. Under the Arduino IDE, the device selected was Arduino Nano w/ ATmega328. However uploading the sketch gives me the error ...
1
vote
1answer
172 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 ...
2
votes
1answer
4k views

how to send argument to ESP8266WebServer objects on function

this probably simple thing to do however I can't think of a way to pass argument to function call ESP8266WebServer server ( 80 ); void toggleRelayOne() { char temp[400]; String msg = ""; if (...
0
votes
1answer
56 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 ...
3
votes
2answers
2k views

How can the Arduino check if it is connected to a PC and the PC is on?

I have been searching around the Internet to find if there is a way to check whether an Arduino is connected to a PC or not. For example: if my PC is turned on, the Arduino will listen to any serial ...
0
votes
1answer
226 views

How to extend my Sketch for Multiple Inputs and Outputs

I am using 4 Push Buttons and 4 leds in my project. Here the sketch is only for one push button and one Led. I want extend my sketch upto 4 push buttons and 4 leds .Please tell what changes I make in ...

1 2 3 4 5