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.

Filter by
Sorted by
Tagged with
0
votes
1answer
34 views

Boolean Logic With Chars For Motor Input Selection

Context of the code: I am trying to control 2 DC motors through an H-gate, this means there are 4 inputs in total: For DC motor 1: Input 1 (VCC) and Input 2 (GND). For DC motor 2: Input 3(VCC) and ...
0
votes
1answer
51 views

Assigning an empty array row to reference [duplicate]

int colors[][3] = { { 255, 0, 0 }, { 0, 255, 0 }, { 0, 0, 255 }, { 253, 7, 210 } }; int (*EXCLUSIVE_COLOR)[3]; I have a two-dimensional array to store some color values. I have a 2nd ...
0
votes
1answer
106 views

How can I list only files that begin with “/LOG?”

Trying to list root directory of LittleFS; but only files beginging with "/LOG." String str; if (!LittleFS.begin()) { Serial....
0
votes
1answer
33 views

Can I check if a message has been sent successfully using Radiohead_ASK?

I'm new to Arduino programming and I'm trying to get a simple 433 MHz transmitter and receiver module working on an Arduino Uno board. Unsurprisingly, it's not working as expected and I'm trying to ...
-1
votes
1answer
24 views

Stopping a motor after a given time period [duplicate]

I have a code to turn on a LED when IR Proximity sensor having a object less than 6cm in front of it, and the LED goes down after it is removed. Now, I want the LED to run for 3 seconds only, even if ...
0
votes
1answer
78 views

Stopping the program after 1 second

I am a Beginner in Arduino Programming. I am working on a project where I control A DC motor with IR sensor and arduino. Until here it is fine. But I want the Motor to stop after one second even ...
0
votes
1answer
42 views

About ATTINY85 Development Board

I am thinking to buy one of "ATTINY85 Development Board"... Before buying I was checking details/Advantages of it. First I thought this is just a breakout board & USB for power. But, then found ...
0
votes
1answer
50 views

Matrix and State Space Arduino Implementation

I wrote an Arduino Matrix class. Then I used this class to implement State Space on Arduino. During tests I stomped upon a problem. After starting the program it stops at some point. I have no idea ...
1
vote
2answers
77 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
42 views

what is causing my esp8266 setup function to reinitialise?

Here is code I have written: #include <stdio.h> #include <ESP8266WebServer.h> #define MAX_WIFI_INIT_RETRY 50 #define WIFI_RETRY_DELAY 500 const char* wifi_ssid = "ssid"; const char* ...
0
votes
1answer
100 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
1answer
34 views

trying to make wemos d1 code modular causes collect2: error: ld returned 1 exit status exit status 1

#include "connection.h" void setup() { Serial.begin(115200); Funcs::Connect conn; conn.connectWifi(); } void loop() { } then connection.h file: // connection.h namespace Funcs { class ...
2
votes
1answer
110 views

Arduino Project Interrupt Error?

I have a project to be made i.e. water Billing System using RFID(Mfrc522) on Arduino NANO. There is one difficulty that I haven't been able to overcome. I hope someone could help me out. Project flow: ...
0
votes
0answers
30 views

combinate two codes [duplicate]

i am trying to put these two codes together someone would be so kind to help me. ""#include const int photores = A0; // Photo resistor input const int pot = A1; // Potentiometer input const int led =...
0
votes
0answers
31 views

Need help Coding Adafruit v1 motor shield for 3 DC motors [duplicate]

My project is that I am building an animated (singing, dancing, head turning, and arm waving) snowman. I have 3 DC motors for individual functions that are to be run via Arduino Adafruit V1 card ...
0
votes
1answer
103 views

FC-16 led matrix module based on MAX7219

EDIT: const char *pc[NUM_ZONES] = { "ROOM", //0 "SUBJECT", //1 "GRADE",//2 }; I did this and I can't get them to display every row simultaneously. void loop(void) { DateTime now = rtc....
0
votes
0answers
25 views

DS3231 clock module with cascaded FC-16 led matrix modules + Arduino Nano

I am using a DS3231 real time clock module and 4 cascaded FC-16 modules(they are basically MAX7219 led matrices based modules). My goal is to display a timetable, a schedule for a classroom on the ...
0
votes
1answer
125 views

Arduino Nano, DS3231 RTC clock module and 4 cascaded FC-16 led matrix modules

Like I said in the title, I am using a DS3231 real time clock module and 4 cascaded FC-16 modules(they are basically MAX7219 led matrices based modules). My goal is to display a timetable, a schedule ...
1
vote
3answers
80 views

Writing elegant applications for Arduino

Coming from a C background, I was taught that tight loops that just burn CPU aren't desirable. Is there any programming style guides on Arduino? Is it common practice to just let loop iterate as a ...
0
votes
0answers
36 views

Modbus programming

I have a Controllino Mega running a code that rotates a stepper one revolution CW, and one revoluction CCW. I need the program to run, just when a signal is received from an HMI that I have connected ...
-2
votes
1answer
107 views

Adafruit motor shield v1 Need help Running 3 DC motors simultaneously?

My project is that I am building an animated (singing, dancing, head turning, and arm waving) snowman. I have 3 DC motors for individual functions that are to be run via Arduino Adafruit V1 card ...
0
votes
1answer
69 views

Pulse generator with varying width

I am trying to generate a square pulse with a fixed delay of 5 second between pulses and varying width of the pulse. The code I wrote so far generates a sequence of pulses every 5 seconds. Is it ...
0
votes
2answers
45 views

Turn RGB blinker via serial

I have a BLUno bluetooth arduino based on uno. the logic kind of works, I am connecting ok to the phone, getting and sending messages via blue tooth but with the serial data, Im having problems ...
0
votes
1answer
35 views

Node.js cannot recognize characters from the serial port

The following script prints everything fine, it recognizes integers from the serial port, but cannot recognize characters. The if statement does not work with characters. I have tried both == and ===...
0
votes
0answers
37 views

hello,i have an problem with my arduino with an lcd

i've totally done everything i could,but when i run my arduino uno with my 16*2 lcd (with i2c) . it has a higher brightness on the top and a lower one in the bottom. ive even tried putting example ...
0
votes
0answers
24 views

Control of 3 LEDs over Bluetooth using MIT App Inventor

As per title, I have 3 LEDs connected to an Uno. Also connected is an HC-05. edit: forgot to add a question, my bad. Is there any glaring major issues in this code that I've overlooked? Not ...
0
votes
2answers
64 views

using different variables in a function

I have a function SetTFgr (float T, int FGr) to set the time and filtergrade of my LED enlarger. It works without a problem and changes the values of T or Fgr according to the buttons I press. Both T ...
0
votes
1answer
23 views

Do Loop query not stopping

I am new to Arduino programming and I would like to ask a question. Firstly apologies if this has been answered before and I understand if it gets locked if this has been answered elsewhere. I am ...
0
votes
1answer
40 views

I keep getting this error exit status 1 expected ';' before 'DigiKeyboard'

\ here is my code include "DigiKeyboard.h" void setup() { DigiKeyboard.sendKeyStroke(0); DigiKeyboard.delay(100); DigiKeyboard.sendKeyStroke(MOD_GUI_LEFT); DigiKeyboard.delay(100); ...
0
votes
1answer
30 views

Why when I pull an EEPROM index the value returned is garbage?

I have an array of colors for my tft screen: const uint16_t colorTheme [] PROGMEM = {BLACK, WHITE, NAVY, CYAN, RED, GREEN, VERDEAQ, PINK, ORANGE, PURPLE, GRAY, YELLOW}; When I try to use colorTheme [...
0
votes
1answer
54 views

How to code an arduino to execute a particular code using a slide switch

I’m pretty new to arduino. I need help concerning a project I’m making. I’m using a SPDT slide switch to switch between what code(method) should be executed.i.e when I shift the switch to the left, ...
0
votes
0answers
29 views

Simulate MPU6050

I’m not able to occur myself an MPU6050 on these circumstances, so is it possible to simulate the MPU6050 on Proteus or a similar software ?!
-1
votes
1answer
24 views

acelermetor count goes down after 1 peak

I am using a Wemos D1 Mini and an mpu 6050 accelerametor. I managed to get the acceleratmetor to work and have 1 value come out of movements. So when a peak it hit (aka, the threshold of 1.00 is hit) ...
0
votes
1answer
73 views

No Websockets Server for Arduino mkr1010?

I've seen some interesting explanations on using websocket comms on mkr 1010 but it's always handling the mkr 1010 as the client and the server being always a computer or some other "non-arduino" ...
0
votes
2answers
62 views

Possibly fried a new atmega328p?

I have a new atmega328p IC that I wanted to program. To do so I placed it into the socket of an arduino uno. I accidentally placed it the wrong way around (180° rotated), and powered it via USB and ...
0
votes
1answer
75 views

How to add a yield before else if?

So I am running my project on a NodeMCU, but I don't know how to let it add a yield in front of an else if. It will give me an error like this: Arduino:1.8.12 (Windows 10), 開發板:"NodeMCU 1.0 (ESP-...
2
votes
1answer
862 views

OTA-program SPIFFS on the ESP8266

Something I'd like information on is whether it is possible to upload a SPIFFS filesystem image to the ESP8266. In theory it might work: It can be uploaded over USB, and according to the logs the ...
0
votes
0answers
85 views

Error compile board LOLIN(WEMOS) D1 R2 & mini

I have a wemos d1 mini and a mpu 6060 sensor. I am trying to send the data from the sensor to Firebase. However i have come across a hurdle which i cant seem to solve. This is my error, can you help ...
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
2answers
177 views

Programming Servo How To Get -90 Degrees

as the question title states, how will I go about turning the servo opposite of 90 degrees? I have written my code as such; // Turn servo to the right if(x > 520 && y < 510 &&...
0
votes
1answer
45 views

Why are begin() functions needed to initialize hardware (if they are)?

I'm writing a program for an ATmega microcontroller using the Arduino framework. While implementing an hardware-related class (one to manage LEDs), I put some hardware initialization code such as ...
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
1answer
96 views

I have a question,an error occured in my code saying TIMSK was not declared in the scope(There are no errors)

#include <SmartInventor.h> void setup() { SmartInventor.DCMotorUse(); } void loop() { // M1, M2, M3 // CW, CCW, STOP // 0-100 // 0-360 SmartInventor.DCMotor(M1, CW, 10); delay(...
1
vote
4answers
233 views

char to String conversion in Arduino program

I have started learning about Arduino and am well versed in Java and Python. In an Arduino program, I need a character input via Serial to be stored in a String variable. From my previous programming ...
1
vote
1answer
60 views

Problem with if condition

So my project is including detecting the temperature in the room by using dth11 sensor. my idea is to add 3 LED lights were each light represent the temperature if its cold or hot or perfect. the ...
-2
votes
1answer
50 views

the boxservo works contrary to the code

i want to make a uselessbox .i connected the circuit correctly,i checked every thing several times and every thing is in right place[ based on descriptions and pattern],but when i turn it on,the ...
0
votes
2answers
140 views

Programming pic microchip

I have a few pic chips, mainly pic16f72 and pic16f73 on old ups circuits, realized they are not that bad. Their adc capabilities are my point of focus. I have an esp32 (my first mcu) and i am very ...
0
votes
1answer
75 views

when i finished coding my 3 dc motors, all these errors accrued one said stray '/302' in the program [closed]

/* #include <SmartInventor.h> */ void setup() { SmartInventor.DCMotor(); } void loop() { // M1, M2, M3 // CW, CCW, STOP // 0-100 // 0-360 SmartInventor.DCMotor(M1, CW, 10, 45°);...
1
vote
0answers
54 views

How to get my LCD contentiously updating with data from sensor?

EDIT DOWNSTAIRS: Hello beautiful people of the internet! How are you smart people doing with all that's going on these days. Okay so the title says it pretty much. I've got a code and inside of my if'...
0
votes
1answer
108 views

Interrupts inside a class attaching to the function of the class

Hello i have a class and i would like to attach an interrupt inside the class and attach it to a function of the class. class counter{ public: counter(int pin){ Ipin=pin; } void ...

1 2
3
4 5
31