Questions tagged [c]

C is a procedural programming language which is widely used in embedded systems. PLEASE NOTE: Arduino is typically programmed in C++, not C.

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

Passing struct from main.cpp to a class

Sorry if this question been posted but I couldn't find the one that matches my issue. I couldn't pass my struct values from the main file to a class. Any ideas? I got this: error: no matching ...
0
votes
1answer
24 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() { // ...
-2
votes
0answers
26 views

Why does it come up with this issue as i only want one argument in there [closed]

if( delayTime >300 ); [ delayTime = 100;//This line gives the error of expected ',' before ';' token ] }
0
votes
0answers
66 views

With what can I replace this for loop so my Arduino doesn't spit jibberish?

I have this: for (int i = 0; i < (DELAY_SIZE - 1); i++) { if (check_tag_in_char(delay_chars[i], BOOK_UPLOAD_END_TAG)) { tag_pos = 0; Serial.println("Uploaded"); ...
0
votes
0answers
10 views

Why is the output turning out to be 'e'.? [migrated]

the output is turning out to be 'e' and i don't understand why?? int main() { char a = 'ae' ; printf("Enter your name: %c",a); return 0; }
3
votes
4answers
213 views

How can I set up outputs without using digitalWrite?

Consider the following: #define IN1 9 #define IN2 10 pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); void LeftMotor(Direction direction) { digitalWrite(IN1, direction == Forward ? LOW : HIGH); ...
-1
votes
1answer
103 views

esp8266 ip address issues

I have android studio app and arduino codes they are connected to each other using esp8266 but it works only on one network when I use another network it doesn't recognise it's ip address instead it ...
0
votes
2answers
36 views

Serial loopback not working with jumper wires connected

I'm a beginner to Arduino programming. Before attempting anything more complex I'm trying to get some very basic functionality first, so using some of the sketchbook examples I'm trying to get the ...
-2
votes
1answer
41 views

Is it permissible to use strlcpy to copy an array to itself? [closed]

Task: delete "\n" at the beginning of the array. Example: char s_msg[15] = "\nHello world!"; void setup() { Serial.begin(115200); Serial.println("Load"); // Search \n if(strstr(s_msg, "\n") ...
0
votes
1answer
27 views

The problem of not saving the previous value when sending it from bluetooth

Controlling Led's from Buttons and Bluetooth by same method The problem now : the LED light up when you send an A over Bluetooth and it will turn off after 2 sec automatically without you doing ...
0
votes
2answers
51 views

A problem with measuring time in a for loop

I am familiar with timing using millis() function, but it seems that I have run into a problem with a for loop. The thing is, I am comparing encoder readings with a value entered via 4x4 keypad. Since ...
0
votes
2answers
43 views

Arduino stops sending/receiving data over Serialport after random time

I got a C# WPF application wich communcates with my arduino uno over serial port. Everything works fine for 3 to 20 seconds then i can not send or receive anything from/to the arduino. What im trying ...
0
votes
1answer
68 views

Can't use uint16_t in library

I wonder why the following minimal example sketch doesn't compile (unknown type name 'uint16_t'): sketch_does_not_compile.ino: #include "myheader.h" void setup() { char a[]="hello world"; ...
1
vote
2answers
52 views

Mixed structure with int and string

I want to create a structure like this: struct commands { int cmd; char descr[25]; }; commands cmds[] = { {16, "Hammond Organ"}, {17, "Percussive Organ"}, {18, "Rock Organ"}, { 0, "" ...
0
votes
1answer
59 views

Scope of RtcDateTime object when declared outside of a function

I'm trying to merge 2 Arduino samples, in order to be able to use DS3231 RTC module with ESP8266 WiFi simple web server. My RTC library is this: https://github.com/Makuna/Rtc/wiki Generally, to code ...
0
votes
0answers
47 views

ESP8266-01 Serial.print returns a blank given a valid string

I am currently trying to create a led matrix with ws2812b leds. I am using an uno on the rear of the display to control the leds and now I want to add wifi capabilities. Since I already had serial ...
0
votes
0answers
51 views

Mqtt setCallback with arduino mega in custom library

in pubsubclient library in method Set callback, calback is defined as MQTT_CALLBACK_SIGNATURE I found in code #if defined(ESP8266) || defined(ESP32) #include <functional> #define ...
0
votes
1answer
47 views

String to Dynamic Byte array

I'm new in Arduino stuck in String to a dynamic byte array. My String: String Finalval="6D616320747820636E662031352033300D0A"; Dynamic Byte array: byte ft[]={0x6D,0x61,0x63,0x20,0x74,0x78,0x20,...
0
votes
1answer
25 views

PWM using timer3 for servo control won't generate any output

I'm making a program for a small robot arm controlled by four servos. Problem: I need for PWM outputs, timer1 has three so i need to use timer3 for the last one The main program and the timer1 ...
0
votes
0answers
69 views

SPI communication with Arduino and PGA411-Q1 resolver sensor

I have been trying to implement SPI communication between an Arduino board and a PGA411-Q1 resolver sensor board. I have set up the Arduino SPI settings as indicated on the resolver sensor's datasheet ...
1
vote
1answer
119 views

Publish chipid to mqtt using ESP32-CAM

I have been trying to push the data of temp, humidity, and pressure from a sensor to MQTT using ESP 32Cam, and was able to do using the following code: pressure = bme.readPressure(); //Convert the ...
0
votes
0answers
55 views

Nothing prints in the serial monitor in Arduino - Ide

Sir, I used Arduino-Uno as programmer and Arduino-Mega 2560 as target and uploaded the below code, I was not able to view the Serial. println lines in the serial monitor, Can you please help. Thanks. ...
0
votes
1answer
33 views

Is if statement correct?

if(temperature < baselineTemp)else{ digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); }else if(temperature >= baselineTemp+2 && temperature < baselineTemp+4){ ...
0
votes
1answer
130 views

Laser Controller using Arduino Uno

---> I am trying to create a controller using Arduino Uno that simply detects pulses from a waveform generator mimicking a Laser Machine and then switches between 4 state machines states at the output ...
0
votes
1answer
111 views

Code conversion

Following is the zabbix documentation with the query header format. Document Zabbix I have difficulty implementing this header in C ++ (Arduino), I saw an implementation of what I need in this forum ...
1
vote
1answer
53 views

Receiving i2c bytes on an attiny85

I've been trying to write a small i2c lib in C over the past week. I managed to get writing to slaves working (for example I can write to an ssd1306 oled) but reading (for example date/time from an ...
0
votes
0answers
38 views

Where is tcp.c?

This question is related to my other question, which I already answered. I want to add modify tcp.c to include my own code. The problem is I can't find tcp.c. The first thing I tried was looking in ...
-1
votes
3answers
259 views

How can I connect 6 solenoid locks to an arduino

Im in college and our research is about a fingerprint based door lock system. We really dont have any idea about arduino. Now we bought arduino mega for our research but I dont know how to connect ...
0
votes
0answers
46 views

Copy the upper 3 bits from one PORT to another

I am stuck in this assignment and I don't really know how to begin. I would appreciate any help or guidance to the following problem:
3
votes
3answers
2k views

How do I extract code from an arduino? [duplicate]

I updated and uploaded some code on another computer that got wiped and didn't send the new code to my current computer, the updated code is still on the board but I don't have access to it. How do I ...
0
votes
0answers
49 views

about required memory size in ATmega32 to execute a certain program

If I want to add two numbers and print the output on LCD char answer[8]; float a=5.1,b=3.2,c; c=a+b; dtostrf(c,8,3,answer);//convert float to ASCII to print it on LCD for(i=0;i<8;i++) ...
0
votes
0answers
130 views

Arduino error in code Stack smashing protect failure!

I get the error when I compiled my code below. I am making an application to read temperature on board ttgo esp32 oled lora stack smashing protect failure! abort() was called at PC 0x400da3e8 on ...
0
votes
1answer
144 views

Can't Compile .ino using ArduinoJson Library

I am using an ESP32 NodeMCU for which I wrote working software before. This also occurs when I just try to compile without uploading, so no hardware problem. I am using the newest version of ...
0
votes
0answers
38 views

Problem in fetching http get request after put float number

I have this codes that works correctly! #include <DFRobot_sim808.h> #include <SoftwareSerial.h> #define PIN_TX 7 #define PIN_RX 8 SoftwareSerial mySerial(PIN_TX,PIN_RX); ...
0
votes
1answer
38 views

How can I stop a loop when using a servo with a Key input?

How can I stop my following code using a key? Basically the code should run the servo in a loop if "t" is pressed and stop the loop if "s" is pressed. #include <Servo.h> Servo myservo; // ...
0
votes
1answer
36 views

arithmetic operation outcome differs from the expected outcome

I am writing a function void Sound_Play(int frequency,int millisec) A part of this function is: counting=(millisec*frequency/1000); //counting is type int Serial.println((String)"millisec="+...
0
votes
0answers
120 views

ESP32 OTAWebUpdater only works on mobile

I'm experiencing something strange. I opened the default ESP32 example "OTAWebUpdater" in the ArduinoIDE and modified just the network part (I created a soft AP instead). The problem is, when I ...
0
votes
1answer
75 views

Serial communication PC to Arduino using C and send via NRF

I'm trying to communicate my PC with an Arduino Mega via serial and after send the message via NRF to another Arduino. But I don't know if the message is send correctly or if it even send the message....
1
vote
2answers
110 views

How do I implement reverse enumeration?

Basically I'm trying to output a string based upon a value in an array, the following code is what I have come up with to achieve my desired result, but I have a feeling that there is a better way to ...
0
votes
0answers
361 views

How to get the value of an Arduino/ESP32 variable and use it in a Javascript file?

I have a variable in my ESP32 code. I also have a webserver that displays a HTML page, and in this page I can type a value in a form and send it to that variable via HTTP GET request. The HTML of ...
0
votes
1answer
40 views

I'm using an Arduino and DS1307 for creating RTC but my code has some issue [closed]

I'm not getting any errors but the values that are supposed be displayed in the RTC_read are not being displayed for some reason.Initially i thought this was maybe due to the code being caught ...
0
votes
1answer
54 views

Serial communication between PC and Arduino using C

I'm trying to send some data to my arduino mega 2560 using serial communication. I'm using the exemple that I found here without success. Every site I read say that I can send data to the arduino ...
1
vote
3answers
363 views

Variable declaration inside main loop

In the past I declared variables inside the main loop which worked just fine. In a new project I did the same: void loop(void) { uint8_t counter; .... if (buttonPress) counter = 0;...
0
votes
0answers
37 views

Controlling UC1638 Graphical LCD screen (C, with Arduino)

I am using Arduino Uno, trying to control LCD screen type UC1638 (240x128 monochrome) I want to fillup the screen in black). Searching up the internet I ended up using this code (written in C): /* ...
0
votes
1answer
164 views

Rounding float number

I want to enable user to change the duration of PWM from 0 to 255, the number should be in minute and increase/decrease with two push buttons. (X) x 255 / 60000 = minute In above example each time ...
2
votes
1answer
147 views

Arduino wrap or subclass print() to work with multiple Serial

I am writing an Arduino program that uses Bluetooth on Serial1 to print text to a Bluetooth terninal on an Android phone and also normal Serial to print text to the serial monitor on a laptop. I would ...
0
votes
0answers
93 views

How to control motor in trapezoidal manner using arduino

I am Working on a project in that i have to control motor in a Trapezoidal motion profile. on Y-axis is the velocity and X- axis as a time. Velocity increases linearly for a certain time, then ...
1
vote
1answer
59 views

Problems with Serial.read()

void loop() { if (sensor.begin() == true) { Serial.print("Current Conversion Mode: "); Serial.println(sensor.getConversionMode()); Serial.println("Enter your mode of Conversion (number ...
0
votes
2answers
63 views

strtoul behavior between C and Arduino

I have this code C code that compiles OK on my laptop #include <stdlib.h> #include <stdio.h> #include <string.h> unsigned int crc32(const void *m, size_t len) { const unsigned ...
1
vote
1answer
307 views

Running Python on Arduino

I've been using Python for quite long, and I was wondering if it can be used as a programming language for Arduino, rather than C/C++. When I'm using the Arduino IDE, the sketch is compiled into a ...

1
2 3 4 5
8