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

learn more… | top users | synonyms

-1
votes
1answer
49 views

Simulated Arduino displaying same temperature over and over again

I'm new to Arduino so im still getting used to it...ineed to read the temperature of temperature sensor in arduino. Whatever i do, it keeps displaying same temperature(don't even know if that's wrong, ...
0
votes
0answers
32 views

ESP8266 (Wi-Fi Module) interfacing with PIC 16F or 18F microcontroller

Has anyone interface PIC16f877A or PIC18f4520 or any other PIC microcontroller with wifi ESP8266 Module, need some sample code to send and hit url using TCP connection command. My hardware part is ...
-1
votes
0answers
53 views

How to create a class for arduino and how to access its variables from the sketch [closed]

I've already written my own arduino library for some purposes and it is working. I wonder how to write classes for my arduino project so that they can communicate with each other? Secondly, as I ...
4
votes
4answers
112 views

Arduino: How to get the board type in code

I want to write a sketch that can be compiled on different Arduino boards. I want to display on the PC which board is currently connected. This means that the user connects the PC via USB cable to ...
1
vote
2answers
56 views

How to write array of functions in arduino library?

I've nine functions each of type void as follow: void zero(); void one(); void two(); void three(); void four(); void five(); void six(); void seven(); void eight(); void nine(); I've put all these ...
0
votes
1answer
11 views

How to append float value of into a string ?

I have a float variable lng = 33.785469 and lat = 78.126548. Now can I convert them to String and append in a String variable "my_location" as "your location is \nlng = 33.785469 \nlat = 78.126548". I ...
0
votes
1answer
38 views

Timer/Counter programming Arduino

I'm trying to blink an LED on an ATMega328P (same MCU as Arduino I think..) using the internal timer but I'm stuck since it doesn't seem to light the LED at all.... #include <avr/io.h> ...
0
votes
2answers
48 views

Arduino & ARM - Replacement for avr-libc?

There is very cool avr-libc library that provides direct access for all functions of AVR microcontrollers. I'm writing a project for Arduino Due and I want to use timers and ISRs directly. Is there a ...
1
vote
1answer
37 views

Atmega328 PWM frequency setting not working

I have an Arduino UNO with Atmega 328 SMD, and I am trying to use PWM, but by setting registers, not using analogWrite(). My code is: DDRD |= (1 << PORTD6); //Setting pin D6 as output OCR0A = ...
2
votes
1answer
69 views

Arduino can't multiply?

I have a value I'm taking from a sensor module, which is 2500 when the sensor is facing a light source. This reads to my code and can be saved perfectly fine. When I try to find the weighted average ...
-2
votes
1answer
46 views

c expected ; before ) token [closed]

void GravaFicheiros(CONFERENCIA *co) { int i, ii, iii; FILE *fp; fp = fopen("grabameisso", "wt"); fprintf (fp, "%s\n", co->nomeconf); int k = NSessoes(co); fprintf (fp, ...
3
votes
0answers
31 views

Arduino throwing error while using modbus RS485 code

I have been trying to make a communication with my industrial drive. All I want to do is read a few values of drive, like current, voltage etc. For that I am using a library: I don't understand why ...
1
vote
2answers
28 views

Check the value of character variable

I'm writing some code for Arduino and I'm not sure if I'm checking the value of this character variable correctly. Can you please tell me if this is correct: const char* front = "front"; const char* ...
1
vote
1answer
48 views

“EVERY_N_MILLISECONDS”

One of the FastLED examples that I've seen was using code that looks like this: EVERY_N_MILLISECONDS( 300 ) { transition_step(); } I've copied it and successfully used it in the same context - ...
1
vote
1answer
41 views

Using an Arduino as the processor for a computer-mouse-like speed detector

I'm looking at making a pretty cheap and easy odometer, eventually for an electric car or similar vehicle. My idea is to implement a big computer mouse, and track the speed with that: a computer ...
0
votes
1answer
29 views

One time execution of a variable incrementation

As part of a larger script intended for a very simple arduino "synthesizer" I am trying to increment the amount of cycles a melody will be played once a key is pressed (the key in turn passes a value ...
1
vote
4answers
145 views

Few questions related to programming microcontrollers

I'm learning "Arduino" (I don't have previous knowledge of microcontrollers). I have few questions: What is the difference between programming a microcontroller in C and programming in "Arduino?" Is ...
0
votes
1answer
41 views

Correct solution for “multiple definition of” compile error

I'm in the process of trying to take this demo sketch and extract the necessary bits into a modular library that can be included in other sketches. Here's where I'm at so far. Here's the test sketch ...
0
votes
1answer
75 views

Arduino does not work

When I try to upload a sketch to my Arduino Uno R3 then sometimes I get the following issue: At the beginning the RX LED flashes three times and then I get errors: avrdude: stk500_recv(): ...
1
vote
0answers
47 views

Teensy 2.0++ SDA SCL pins not accesible using ARDUINO software

Hi I was looking to interface Teensy++ 2.0 with MPU6050 for a simple IMU project. I have done this previously using Teensy 3.1 by trying the project of kriswiner however I also wanted to try it out on ...
0
votes
2answers
85 views

Compare const char * to const char

Using ArduinoJson I have assigned a value such as; const char* id = root["id"]; in the original JSON id was "1" if (strcmp(id, "1") == 0) { // this executes } I have an array of structs that ...
4
votes
1answer
57 views

Combine bits from two ports into a single byte

I'm attempting to read the values of 8 pins at a time into a byte. The obvious answer to this seems to be the Port registers, however with the way the Arduino is wired, I'd have to split my read ...
5
votes
2answers
159 views

Arduino DC motor causes disturbance. What can cause it?

I tried to fix this problem the whole weekend but, after no success I decided to post it here. I would really appreciate any help. The problem The Wi-Fi module activates the DC motor and lets it run ...
0
votes
3answers
68 views

Arduino C, Led > binary alternative all lights

I'm trying to alternatively have a random int generate a binary number with 4 lights. This is my current code, However, it seems that all the lights(leds) go on, I don't think the minus option ...
1
vote
1answer
40 views

exit(0) function shows up an error

So I have been trying to write a code where I use the millis() function to print the milliseconds of on-time of the board using Serial. But the condition is I want to stop printing the value once it ...
1
vote
0answers
74 views

Serial Communication, Arduino and Rpi , C library

I am currently working on a project on serial communication between RPi and Arduino. This is the code that I am using from RPi side, it's in C: int main() { //------------------------- //----- ...
0
votes
1answer
315 views

ESP 8266 with sdk 1.5

By compiling using sdk v1.5 i got following error.Any idea how to resolve it? mingw32-make.exe -f C:/Users/abc/worksorg/mesh/Makefile all AR build/app_app.a LD build/app.out ...
0
votes
1answer
63 views

Arduino Simple Task - sweeping a buzzer and led, not working as expected

Use of the tone() function will interfere with PWM output on pins 3 and 11 (on boards other than the Mega). UPDATE: IT seems that there is a problem using pin 11 and 13 together but if I use a ...
-2
votes
1answer
97 views

Peer to peer communication

Hello guys , I want to perform a mesh network between 3-4 modules using ESP8266 . Any one have idea how to do it?
0
votes
2answers
69 views

Interface pressure Sensor

Hello folks, I am using G1/4 Pressure Transmitter Sensor 0-1.2 MPa sensor can you guide for programming part.The conversion from bar to pascal or bar to Mpa or pascal to psi.Though I am ...
0
votes
1answer
48 views

Popen command restarts arduino [duplicate]

So I am trying to make a Mac OSX program with Cocoa that will be able to control my Arduino via serial. I currently have the C command popen("echo 7 > /dev/cu.usbmodem1411", "r"); to try to ...
0
votes
2answers
271 views

Error in my Arduino code “ error: expected unqualified-id before ‘if’ ”

I cant seem to find this error is: elevator_bug_2.ino:38:1: error: expected unqualified-id before ‘if’ Here is the code: // these constants won't change. They are the // lowest and highest ...
1
vote
1answer
106 views

Timer interrupt won't work if the ISR is not set

I am using an Arduino Mega 2560. I have a code in a c file, that looks like this: #include <avr/io.h> /* for DDRB, PORTB, etc. */ #include <util/delay.h> /* for ...
0
votes
0answers
52 views

Is there any way to import libcoap into Arduino project?

I am currently playing with libcoap (https://libcoap.net) client-server architecture. I need directions importing libcoap into Arduino project. Or any other way to implement CoAP (constrained ...
0
votes
1answer
47 views

Issue with leOS2 for one-time tasks

I'm trying to use the last version of leOS2 scheduler from Leonardo Miliani ( https://github.com/leomil72/leOS2 ) but I have a strange behavior with a very simplistic ONETIME task. Platform : Arduino ...
0
votes
3answers
44 views

Problems with linking a library with a c program in linux

I am totally new to C and arduino. I want to run serial commands from a Bealgebone to a 4Dsystems display. Therefore I copied the c library found here into a directory and created a test program ...
0
votes
2answers
121 views

What wrong with that code? [duplicate]

Hi i have made this code its so simple its should receive data from the computer and send it back via the serial but the problem is he do not what it is suppose to do when its run its keep sending -1 ...
1
vote
1answer
47 views

Arduino snake on 5110 screen - some help needed

I'm trying to make a snake game using the u8g lib. But for now, only the second body part of the snake follows the head, where I want the whole body to follow the snake's head and I don't understand ...
2
votes
1answer
44 views

How does this code move the bird sprite in this sketch?

I'm teaching this sketch in my class. I understand most of the sketch and can see the class that makes the bird move, but I still don't quite understand how the code makes the sprite "move." I can ...
0
votes
3answers
44 views

Arduino ethernet need help with game logic!

I'm making a game where there are three LEDs and three buttons: 1 LED for 1 button. One has to press the button that has its LED lit. If it is correct, another (random) LED will light up and the game ...
-1
votes
2answers
104 views

arduino project for c programming language [closed]

i am a student from 2nd semester BCA (Bachelor in Computer Application). My group need some project for presentation from c programming language so i thought of using #ARDUINO project for our ...
0
votes
1answer
59 views

Interrupt not firing on motion

I'm trying to get MMA8452Q to trigger an interrupt when motion is detected and wonder if I'm missing something very obvious here. So I setup CTRL_REG4 to 0x0B with void MMA8452Q::setupISR() { ...
1
vote
2answers
99 views

Not waking up more than once?

I'm trying the following code on an Uno. I'm pulling the high side of a pull down 10K resistor to 5V, but it can only be woken once. Just once. Does anyone know why this might be the case? It works ...
0
votes
1answer
55 views

Interrupt variable not getting called while executing another part

volatile byte _incomingFlag = 0; void onIncoming () { _incomingFlag = 1; Serial.println(F("You got an interrupt")); mySerial.println("ATH0"); } void setup () { /* First Start the ...
1
vote
2answers
52 views

Arrays and Functions

How can I return a char array from a function? char c[] = getFloat(val, valid); char getFloat(float val, bool valid){ if(valid){ char stringFloat[16]; dtostrf(val, 10, 8, ...
0
votes
0answers
66 views

Two identical functions, one works one doesn't. why?

I'm cross-posting this with the Arduino exchange because I'm not sure if it's a problem with my C or something else entirely. I'm attempting to communicate over WiFi using the process library (Part ...
1
vote
1answer
41 views

Why is my variable not getting updated?

I have the following snippet of code: const unsigned long fiveMinutes = 5 * 60 * 1000UL; unsigned long lastCheck = 0 - fiveMinutes; unsigned long now = 0; void loop() { now = millis(); if ( now ...
0
votes
0answers
118 views

Adafruit Trinket & Ultimate GPS & Google Earth Realtime

I'm using a 5v Pro Trinket that has an Adafruit Ultimate GPS connected and is connected over serial to my laptop. I am not using any fancy parsing code, I'm just letting the GPS spit out the raw data. ...
1
vote
1answer
243 views

Software I2C - Atmega8

I am using Atmega8 with 12MHz crystal, on my breadbord. I can use SDA and SCL pins with default arduino library wire.h, and it works. But I want another pins to use I2C protocol. I tried library, ...
0
votes
3answers
527 views

AES Simplified for Arduino - Having hard time achieving desired result

Okay, here's the story. I'm not very familiar with how Arduino works but learning. I have a project that requires AES encryption on the Arduino Uno. As per a previous question we managed to figure out ...