Questions tagged [sketch]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
69 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
65 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
2answers
50 views

How can I set a calculated value when my sketch is uploaded?

I have an Arduino based countdown timer that counts down the number of minutes remaining to an event and displays them on an LCD. Since the event's start time is fixed, I have to re-calculate my ...
0
votes
2answers
7k views

Keypad number input and store

i'm stuck with a little problem. I need to create a program that can store a number via keypad (this number will be chosen by the user) and then do something with it. To be more specific i will create ...
0
votes
1answer
121 views

How do I convert a program made on Notepad to my Arduino on Proteus

I had the Arduino IDE but I accidentally deleted it. I have no internet connection, so I could not download it again. I do not currently possess the Arduino hardware itself but I do have Proteus and ...
0
votes
1answer
2k views

Counting revolutions of a DC motor with a Photo Interrupter

I have a DC motor which is rated at 11 200 RPM. I would like to count the actual RPM (it seems to be maybe 1500 RPM from what I can tell manually.) I bought a Photo Interrupter, and have connected ...
0
votes
1answer
420 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 ...
0
votes
1answer
635 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
2answers
183 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
1answer
84 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
73 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,...
0
votes
1answer
134 views

Should I use a loop instead of an If statement?

I have a simple sketch that tests input from 2 touch sensors and outputs to 2 relays (if a sensor is touched, trigger the respective momentary relay). It has been a bit quirky to say the least. ...
0
votes
2answers
2k views

What's the difference between DDRB and pinMode?

It's my understanding that the following lines are equivalent. They seem to be interchangeable in my sketch: DDRB = 1<<DDB0; and pinMode(0, OUTPUT); Is the first form (DDRB...) setting a ...
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
1answer
1k views

Controlling HC-05 from a sketch

Hi I am making a sketch and circuit with a HC-05 BT receiver to upload sketches via Bluetooth to my Uno. This requires giving AT commands from the sketch. I would like to see the response from the ...
0
votes
1answer
585 views

Arduino compiler uploading last saved version of sketch, not current

Is this an issue or a defined behavior? I am using Arduino IDE 1.6.6 Sometimes I made changes in code, and immediately upload them to the Arduino board. And many times issues already fixed are ...
0
votes
1answer
456 views

How to extract the last byte out of an IP adress

Newbie question: I need to pass the last byte of a local IP as a parameter. Eg.: when Ethernet.localIP() returns 192.168.0.100, I need to extract the 100 and put it in a char array or string. Anyone ...
0
votes
2answers
508 views

Sending data from Arduino to the server where arduino (sketch) acts as a client

I want to make simple client-server program where arduino behave as a client. For example I have a LED connected in arduino board that is controlled by a switch. With the switch I can turn off and on ...
0
votes
1answer
94 views

How to upload program to board using Arduino sketch ver 1.6?

I am having problems uploading my program. I have been using the verify button aka the "checkmark" to upload my programs. I assumed that this was the correct button but now I am having problems ...
0
votes
1answer
213 views

Interrupts don't work

I tried to run a sketch that tests my AVR's interrupts, I have an UNoriginal Arduino Uno, and I've checked pins 2 and 3 like the following: - at void setup() attachInterrupt(2, inter, CHANGE); - at ...
0
votes
1answer
791 views

Unexpected behavior of sprintf with i32/u32

I'm trying to build a string of characters from several elements given by the TinyGPS++ library with the use of sprintf(). This is my code making the string and printing it in the serial monitor. ...
0
votes
1answer
578 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
133 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
263 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
203 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
71 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
1answer
76 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" ...
0
votes
2answers
403 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
76 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
102 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
2answers
122 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
1answer
1k views

Arduino Sketch: NodeMCU compilation error

Every time I try to compile a program written in Arduino IDE 1.8.5 for NodeMCU (LoLIN version v3), I get the following error: Arduino: 1.8.5 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz,...
0
votes
1answer
212 views

Auto Fish Feeder

Good day, I am new to Arduino, but have made some nice projects work. I have a n issue with a Auto fish feeder. I have used a servo that I modified to run 360. I am having a issue when the Nano board ...
0
votes
1answer
115 views

Help! My motors are not working!

I have made a project using Arduino, 3 LDRs and a L293D motor driver shield. My project was that when I block light from the first LDR, the motor will spin. When I block light from the second LDR, the ...
0
votes
1answer
4k views

Is it any way to connect ESP8266 to wifi faster?

I'm uploading this sketch to try connecting ESP to internet. However, most of the times I've ran it it takes a very long time to connect, a lot of times I've had to break the process because it seems ...
0
votes
1answer
79 views

3D printer Arduino sketch

I'm building an automatic warehouse system using 3 nema17 stepper motor. My problem is to move the motors with precision, since I do not have any kind of encoder on the motor and so I cannot know the ...
0
votes
3answers
1k views

What is the best board for setting up an SSH protocol to an Arduino?

I currently have a project using an Arduino R3, set up across the room from my computer. This has become quite annoying, as every time I want to push something to the Arduino I have to get up and move ...
0
votes
1answer
296 views

Typedef Function Pointer Invoking Issue

I'm having an issue trying to use a normal non-member function of my main sketch file as a callback. I can't get the function pointer to invoke from a function other than it was saved. More info ...
0
votes
2answers
109 views

What does the following code in Morse Code Arduino mean?

struct node *root, *currentNode; root = (struct node*)malloc(sizeof(struct node)); root->value = '\0'; root->next = 0; currentNode = root;
0
votes
1answer
519 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 ...
0
votes
1answer
2k views

Trying to get my mega 2560 to work for my 3d printer

Trying to pit marlins v2non this board and it gives me an error and I have no idea what to do Arduino: 1.6.10 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)" Sketch ...
0
votes
1answer
2k views

How to split a string into substring Arduino

I'm about identify myself stupid, howcome I couldn' t figure out how to split a string into substring using arduino, even after 10 days of searching. The number is fact... So, As Mr.Arduino.cc says: ...
0
votes
1answer
343 views

Using two ultrasonic sensors together

Using two ultrasonic sensors together, how can I enable one before the other?
0
votes
1answer
2k views

Arduino OOP and [this] keyword

Lets say I have a sketch called mysketch.ino with these contents: String globalString = "ThisisGlobal"; void setup(){} void loop(){} How can I pass THIS sketch mysketch.ino as an object or its ...
0
votes
2answers
2k views

how to count blinking LED flashes using arduino uno boards and LDR?

i want to know code for counting the flashes of LEDs and display no. of flashes in particular time given.by using LDR. basically i tried it with interrupts but i'm not getting it,so please help in ...
0
votes
1answer
57 views

Detecting Motion behind a robot

I am building a motion following robot. It has two PIR sensors on the left and right. It has an ultrasonic sensor in the front. When either of the PIR sensors detect motion then it turns to that side. ...
0
votes
1answer
250 views

Details on OV7670

I am thinking of working on a project based on a camera module OV7670. I am making a security system using an arduino where detected motion (I am also using a PIR sensor) will trigger the camera ...
0
votes
1answer
252 views

How to upload Arduino sketches to Atmel chips

I am new in this Arduino coding world and I was trying to make a project. I normally used Arduino Unos all the time, but I was facing a problem and that is that the Arduino Uno has only 13 digital ...
0
votes
2answers
5k views

Clearing SRAM in loop()

Very broad question here. I don't know exactly what the problem is but I'll edit this post as we narrow down the possibilities. I think I'm running into memory constraints. I'm running a sketch ...
0
votes
1answer
82 views

Broken Score on Game Sketch

I have modified the code for Flappy Duino to give me a score at the end of the game. Here is the code: #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> ...