Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [programming]

The process of designing and writing source code as part of a program (or sketch) for Arduino. For questions about uploading code to an Arduino board, use the [uploading] tag instead.

-1
votes
1answer
21 views

Code and wire a LCD and button [on hold]

I need to code and wire: “Button is pressed.” to an LCD screen when a button is pressed. When the button is released, the LCD should display, “Button is released.” NEED HELP!!!
0
votes
1answer
30 views

128x64 and pushButtons

Could someone give me some advice related to building a menu for a 128x64 LCD using 5 pushButtons? i have 5 screens. btn1 is for display MainMenu and Selection. btn2 and btn3 is for up and down ...
0
votes
0answers
15 views

UDP Packet not receiving

I started a project where I wanted to send sensor data from one arduino to another and let this 2nd Arduino send the data to a tablet to visualize sensordata like speed, temperature etc. I wanted to ...
0
votes
0answers
16 views

Power Factor Measurement

I'm developing a system to measure the power factor between two waves and using a XOR to get the time between them. The programming and the circuit seems fine but some times I get the power factor as ...
0
votes
0answers
20 views

Need Help Understanding PS2X Library

I bought an Arduino Tank recently that uses the PS2 controller and receiver. It comes with the PS2X_lib Library and I couldn't get a good grasp of what some of the functions do. Question: In ...
1
vote
1answer
18 views

Press one button then another?

Let's say we have two buttons - button 1 and button 2. What I need to do is to do something (like turn LED on) when button 1 is press, then button 2 is pressed. I can do it realy simple by just using ...
0
votes
1answer
11 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 ...
0
votes
0answers
9 views

Trouble running two NEMA 17's with a joystick

So I'm trying to make a motorized dobsonian telescope using two NEMA 17 motors with Easy Driver boards. I want to control the x and y axis with a joystick. I found a code that ran one with a joystick ...
0
votes
0answers
24 views

ESP8266 accepts commands but returns nothing

I've been struggling for a couple of days now with the module ESP8266. I have tested it already with another Arduino (RX-RX / Tx-TX) and I could send some test commands and receive the corresponding ...
0
votes
1answer
26 views

exit status 1 'mySerial' does not name a type

I just can't make it work for some reason. I tried #include <SoftwareSerial.h> and I tried #include "SoftwareSerial.h". Can someone help me? #include <SoftwareSerial.h> SoftwareSerial ...
0
votes
0answers
29 views

i2C master/slave Arduino uno Programming to run 2 motors at once off separate boards [duplicate]

I am attempting to run a master/slave receiver arduino using two arduino uno's. I'm synchronizing both Arduino to control 1 dc motor and 1 stepper motor at once which each of the Arduino UNO board ...
-1
votes
0answers
39 views

i2C Arduino Programming [on hold]

I am attempting to run aI'm synchronizing both Arduino to control 2 Motor driver module which each of the Arduino UNO board controlling a single motor driver module. For sure there will be one master ...
1
vote
1answer
124 views

declared variable inside void setup is forgotten in void loop

if i declare a var in void setup() and try to do something with it in void loop(), it just says that the variable is undeclared. here is the code: #include "Servo.h" void setup() { Servo servo1; ...
0
votes
1answer
35 views

How to use PROGMEM in a .h/.cpp file instead of a .ino file?

I want to use a lot of .h/.cpp files to be used by my ino sketch. In one of these .cpp files (and later more) I want to use constant arrays (like lookup tables). To save SRAM I want to use PROGMEM. ...
2
votes
2answers
178 views

Why does a variable size struct not compile in the Arduino IDE?

This sketch does not compile in the Arduino IDE void setup() { // put your setup code here, to run once: } struct test { int i; char variable[]; }; typedef struct test test; test t = { 0, ...
1
vote
2answers
47 views

Is new without a delete acceptable?

I know it is not a good practice to use the new command to dynamically create data, however, if I would never use the delete, would it result in memory gaps/other problems? Background The reason I ...
0
votes
1answer
32 views

Using an Arduino to manage graphics [closed]

Arduino game consoles are great, but they suffer from low write speeds and low memory. Is it possible to use an Arduino to handle all the back end code and another one for graphics
0
votes
1answer
25 views

Nodemcu ESP12-E (ESP8266), Can I reprogramming when the UART pins are defined as GPIO?

I wonder if there may be any problems using the pins that the UART are using as GPIOs, if now I want to be able to reprogram the circuit? (Of course I will detach the ESP12-E from the mainboard before ...
1
vote
0answers
33 views

Clear Timer on Compare or CTC in ATmega328P, Toggle OC0A on Compare Match

I want to use the CTC on the ATmega328P to play same notes with a speaker, a project that I find in this book. In the data sheet I read: For generating a waveform output in CTC mode, the OC0A ...
1
vote
1answer
38 views

Read the value of a register in arduino

I want to read the value of the register (8-bit). In particular I want to read the values of: The Timer/Counter - TCNT0 ( Adress 0x26 (0x46) ) The output compare registers - OCR0A and OCR0B. Is ...
0
votes
3answers
38 views

Arduino keeps looping

I made a program where I give a number(4 bit) as input and four led on the breadboard lights up according to its binary. The problem is the program works all well only for (2-15) but if I give 0 or 1 ...
1
vote
1answer
21 views

Is new.cpp programmed improperly? Arduino 1.8.9

I'm having trouble with my code and I'm not sure if it's a memory allocation issue. So I look at the new, delete to see if it throws errors, and finding the source code I find outrageously simple ...
1
vote
1answer
53 views

Working with Wire core library

I'm studying the Wire library code driver utility/twi.h to learn how twi buffering and ISR management work. What I did actually, is that I copied the header/source files from the Arduino path F:\...
0
votes
2answers
37 views

Questions about HMC5883L library

I'm studying the structures of libraries currently. I want to learn how good programmers write code, what are the strategies they follow, the art the programmer followed to develop the library. And ...
0
votes
1answer
15 views

Implementing sending from N and recieving from N with FreeRtos and RF24 radio module

I'm trying to make my first chip send data through a nrf24 radio pipe and the other listen to it. After the first data is received it should switch to transmit mode and itself transmit new data. The ...
1
vote
1answer
34 views

`LOW` being defined as `0` and `HIGH` being defined as `1` - is this a part of external specification?

Arduino.h defines LOW as 0x0 and HIGH as 0x1. Does the Arduino API intend to expose that fact? Does it guarantee that this will always be that way? In other words, what is the intended purpose of ...
0
votes
2answers
33 views

How to write a function to return matrix?

I need a function to return a 2x2 rotation matrix, something like: float matrix(float phi){ float R[2][2] = { {cos(phi), -sin(phi)}, {sin(phi), cos(phi)} }; return R; } But ...
0
votes
1answer
20 views

nodeMCU - 2 loops at a time - one continuously and second every 10 seconds

i have nodeMCU v3(esp8266) so i need to make 2 checks 1 check is the pin D1 which needs to be done continuously and another check is web link check every 10 seconds, problem is coz when i put delay ...
1
vote
1answer
450 views

'Var' does not name a type!

I don't have much experience in C++ programming. I'm getting this error 'z' does not name a type!!! which I have't seen in MATLAB or python... What's wrong??? It is so simple!!! float x=10; float ...
1
vote
1answer
34 views

STM32YYXX chip series is not defined in boards.txt

The STM32YYXX chip series is not defined in boards.txt? How can I solve this? I am using Windows 10 with Arduino IDE 1.6.6
0
votes
0answers
28 views

Fastest way to convert binary string to a number?

I am using a Teensy 3.2 board as control logic for an ADC that I am building for teaching purposes. Currently, I am employing an attachInterrupt() to detect the rising edge of an external clock pulse ...
0
votes
1answer
30 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 ...
4
votes
1answer
58 views

How do you combine 2 different sketches together

(Before you down-vote this, note that it is a "ringer" to answer a FAQ, with a self-answer.) This question comes up all the time. How do you combine 2 different sketches together? Say I have a sample ...
1
vote
1answer
24 views

Reading text line by line from SD

Why does the following code return this error? How can I make this work? Error: exit status 1 invalid conversion from 'const char*' to 'char' [-fpermissive] #include "FS.h" #include "SD.h" #...
0
votes
3answers
55 views

Does bool return an int?

I know that for the Arduino (and C in general) that for comparison sake, "false" is 0, while any non-zero integer is "true". The question that I have is does the bool data type "return" a concrete ...
0
votes
1answer
51 views

How do I make a counter that counts the amount of active inputs [closed]

I want to make a direction guide using green, yellow and red LEDs. The lights need to change when ever the active input1 reaches a set value, for example: Green when the value is lower than 12; ...
1
vote
1answer
66 views

Osepp DS1307 RTC program error (tmElements_t tm; does not name a type)

Using a basic 1307 SetTime program, and ran into a problem (first time programming a module). #include <Wire.h> #include <Time.h> #include <DS1307RTC.h> const char *monthName[12] = ...
0
votes
1answer
36 views

Run function when triggered

I'm trying to create a motion/fall sensing device. I have a sensor that continuously checks if motion and fall is detected in void loop(). If both motion and fall are detected, then I'd like to send ...
0
votes
2answers
122 views

expected `}' at end of input

int scvVal = 6; int drvVal = 9; int sensorVal = A1; void setup() { Serial.begin(9600); pinMode(6, OUTPUT); pinMode(9, OUTPUT); } void loop(){ sensorVal = analogRead(A1); Serial....
1
vote
1answer
39 views

Seeburg Consolette Jukebox

I am working on a Seeburg Jukebox wall unit, I have it playing one track at a time form a SD card no problem. But what I need help with being new to programming is: 1. The code is long because it can ...
0
votes
0answers
19 views

empty message receive

#include <GSMSim.h> #include <SoftwareSerial.h> #define RX 7 #define TX 8 #define RESET 13 #define BAUD 9600 GSMSim gsm(RX, TX, RESET); const int doorSensor= 2; int doorSensorState= 0; ...
0
votes
1answer
48 views

can someone check my code, my Arduino isn't doing a consistent count cycle

Wondering if someone could have a look at my code and let me know if there's something wrong with it. I had the code done for me a while back and did a quick test and it seemed to work. I have now ...
2
votes
2answers
45 views

What Version of the Sketch did I leave on there?

Is there a way to "ask" the Arduino what sketch was compiled on it? There are several versions of the sketch and I need to see which version the Arduino has been running.
0
votes
1answer
49 views

Invoke a method in the main sketch from within a library

I need to use a specific library that issues error messages in the form of String texts. The library uses the Serial.println() function to send the messages to the Arduino IDE's serial monitor. The ...
0
votes
2answers
42 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
0answers
47 views

Cannot write pin LOW

All the other examples I've seen have had coding errors where they set a pin LOW in a loop with no delay so that it goes high again right away - but this problem is different, and probably something ...
0
votes
2answers
68 views

Prevent function inlining

I'm trying to shrink the compiled code size, and I have noticed that the compiler inlines functions a lot, even the ones I have not marked "inline", but I can't manage to turn that off. It looks like ...
0
votes
1answer
37 views

LCD displaying weird text

I am doing a project that requires input from a keypad to be displayed on the LCD display. lcd.print() displays in proper form, but when the I press characters on the keypad, they are overwritten as ...
0
votes
1answer
81 views

Multiple definitions of “xxxx” [duplicate]

I really need your help. I use VisualStudio and PlatformIo I still get this error: Linking .pioenvs\esp12e\firmware.elf .pioenvs\esp12e\src\main.cpp.o:(.data.DebugX+0x0): multiple definition of `...
0
votes
1answer
51 views

Any idea why my LED fails to operate with the if statement

I have tried several workarounds without success. #include <LiquidCrystal.h> float tempC; int tempPin = 0;// BS E D4 D5 D6 D7 int buzzer = 4; int LED =2; LiquidCrystal lcd(7, 8, 9, 10, 11, 12);...