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
0answers
39 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
116 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
87 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
46 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
33 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
69 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
44 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
32 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
55 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
27 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
32 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
34 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
51 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
53 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
85 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
142 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
29 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
42 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
241 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
26 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
57 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
75 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
53 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
52 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
51 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
154 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 ...
0
votes
1answer
54 views

"variable does not name a type

Hey guys I'm getting an error that is im pretty sure to do with how i am initializing my variables. It is: exit status 1 'threshold' does not name a type Here's my code: //Global Variables for ...
1
vote
2answers
46 views

Multiple defintion error, Linker error [closed]

Trying to create an elf file for two sets of files in different folders. LIDARBOT.h ----------- #ifndef LIDARBOT_H_ #define LIDARBOT_H_ #include <avr/io.h> #include "drivers/motors.h" #endif ...
0
votes
1answer
33 views

Split serial monitor output to only save part of the output

This is the output i get from the serial monitor from using a HM10 in . How could i go about splitting the data using arduino uno. I only want to save the last 12 digits before the :- (4CAA0DE091B7) ...
1
vote
0answers
58 views

local libraries and include dependencies

I'm using PlatformIO in Atom for Arduino programming. I get dependencies error when build. This is my reproduction sample code: /lib/mylib/mylib.h #ifndef MYLIB_H #define MYLIB_H #include <...
0
votes
0answers
42 views

Arduino Sensor Values to Raspberry Pi using NRF24

Im trying to send temperature sensor data through NRF24L01 to Raspberry Pi and read it in Raspberry Pi using python. But the temperature sensor data comes to the Raspberry Pi as letters, which I found ...
0
votes
1answer
298 views

Stack smashing protect failure ESP32 with Modbus RTU

I'm doing a project using an ESP32 TTGO with LoRa, the Max485 and a WELLPRO ADAM 8082 for Modbus communication. I'm trying to use the ESP32 as a master to and the ADAM as a slave. I'm also using Node-...
0
votes
0answers
29 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 ...
1
vote
1answer
66 views

Display not showing output - Arduino Wattmeter

I have been playing with this code for some time now, I am able to show the results in an 16X2 LCD display, but I am not able to do it in an OLED. here is the code #include <SPI.h> #...
1
vote
1answer
75 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:\...
3
votes
2answers
571 views

Using an external header file

I have a project that is part of a larger repository, and shares header files with non-Arduino C programs. I know that it's possible to use these headers by copying them to the libraries folder, or ...
0
votes
0answers
37 views

PWM C Code some logical error

I don't know what's wrong with the code I have activated all the bits I need. I want the code to slowly increase the brightness of the bulb and then reset and then the same thing goes on. Please help ...
2
votes
4answers
266 views

How to compare a string

How to compare a string coming from serial monitor with some predefined text stored as a local variable? If I say: int led = 2; String a = " abcds"; void setup(){ Serial.begin(9600); } void loop(...
0
votes
1answer
317 views

Pass structure pointer as an argument to a function in c

I am developing a code in which I need to pass a structure pointer value to a function as a parameter. I am calling function "proto485Compare()" in "RS485TaskSlave()". "rs485Msg" contains my data for ...
0
votes
1answer
52 views

Question on pin management using PCA9534PW IO Extender

There is an IO expander PCA9534PW, Arduino UNO. I don’t really understand how I can manage this expander using UNO over I2C. I found an example, but here is the reading mode. What I need: Set the ...
-2
votes
1answer
71 views

Using two leds with one push button [closed]

How can I make the code of this project where I will press one time a button, to turn on the first led (and turn off second led) and when other one press to turn on second led (and turn off the first ...
0
votes
1answer
52 views

When does a pre/post increment occur? [closed]

Editing here to clarify. The headline asks the question but the example given was not ideal. This was a more general Q than about the example code. Compilers have sequence points, places where you ...
1
vote
1answer
728 views

Length of uint8_t* const array

I've an array of type uint8_t* const with 6 items, defined like this uint8_t* const neighbourSet[] = {PEER1, PEER2, PEER3, PEER4, PEER5, PEER6}; Whereas each element in this array is static uint8_t ...
-1
votes
1answer
1k views

'RtcDateTime' does not name a type

I've tested a code that compiles successfully. But after i merged it to another code, here it shown an error says RtcDateTime doesn't name a type. Used library : https://github.com/Makuna/Rtc Some ...
0
votes
1answer
80 views

Random number/sequence output

The program I'm trying to build is: Type in 1st name, hit enter, type in 2nd name and then hit enter again. Register those names from string input to char naming in student struct. Print out the ...
0
votes
1answer
75 views

What's going wrong with my EEPROM?

I've been chipping away at a project for a long time now and I've found a serious bug. Basically the user has an 8x8 grid, and each cell in this grid has a number of properties. I want to be able ...
1
vote
3answers
116 views

How to assign text stored in a local file to a string at compile time

I'm developing a program that uses the HTML server in the WiFi101 library. My hardware does not have SD card storage so all source html needs to be stored as strings in the sketch at compile time. ...