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

0
votes
2answers
31 views

How do I pass an Int Array into void for a foreach loop?

I know its probably an odd question...but I found a workaround for a foreach loop in C. I have a whole bunch of int arrays that I would like to be able to pass into a void, which has that foreach loop ...
0
votes
1answer
27 views

Arduino serial non-blocking

I'm writing an Arduino program to communicate with another module using RS485, so I need to control data flow with one pin. But when I set the pin to HIGH (line 88) it almost instantly falls (as you ...
1
vote
0answers
21 views

Why am I only receiving the first address byte? (I2C Protocol)

Expecting the slave to ACKnowledge and return data, but it does not. This is my protocol. This is my Datasheet. Also FYI I'm on an Arduino Fio but I am not inheriting the Arduino library. #include ...
1
vote
0answers
39 views

Error with libraries after setting up Code::blocks to work as an arduino IDE

I followed this guide: http://arduinodev.com/guide-to-arduino-development-environment-codeblocks/ Everything seemed to work until I compiled the example code: #include <Arduino.h> /* Turns ...
0
votes
1answer
48 views

Why does this code show me a lot of space?

I want to make a 4hz reading of GSR and temperature, in the following format for every second: 697,20.8744 696,20.86521 695,20.8653 699,20.8777 The print, in python, would be print(GSR+","+Temp) ...
0
votes
2answers
28 views

Removing Element From Array While Keeping Order

I'm building a wireless mechanical keyboard. There is an array of 6 elements that stores the keys pressed by the user (since 6 is the max number of keys you can send at once over Bluetooth). An ...
0
votes
1answer
24 views

Why does this method return an unprintable character, how do I convert it to display correctly?

Page 14 says that the method should return the value 'h17' typedef struct { uint8_t data; uint8_t timestamp; unsigned char crc; } tData; int main(void) { unsigned char* tempData = "snap"; ...
1
vote
1answer
26 views

How do I use SNAP protocol, correctly?

I've reviewed the documentation I'm still a little lost when it comes to applying the functions. Each of the redundancy check methods take in an unsigned char and return an unsigned char. Shouldn't ...
0
votes
2answers
17 views

Stop multiple presses in vex bumper (Unexpected bumper output) [closed]

According to Official documentation of the Vex Bumper, it states that the bumpers will cause: the robot sometimes [counts] a press twice. This issue is also caused by the robot counting too fast ...
3
votes
1answer
41 views

Using map for DC motor instead of servo

I am trying to use map command which is used to power servo 180 degrees as the potentiometer moves... in fact what i want to do is just when i adjust my potentiometer to zero; stop the dc motor then ...
0
votes
2answers
47 views

Fastest way to test if two integers differ by 4 or equal to each other

I'm searching for the fastest way to test if two integers are equal or differ by 4. The integers can be positive, negative and equal to zero. They are between -1000 and 1000 and are exclusively ...
0
votes
1answer
47 views

How to convert array of chars to array of ints?

I have a rather newbie question but I can't figure it out. Lets say I have this char array: char array[] = "10,11,12,1,0,1,0"; How can I convert it to an array of int like this? int arrayINT[] ...
0
votes
1answer
31 views

Understanding the contents of a library in C

So this is a question not just about the #include but most all includes you find while programming in C. So I understand a library is prewritten code and when you include that library are you able ...
1
vote
1answer
70 views

Problem reading an EEPROM chip using I2C protocol

I am trying to read an EEPROM chip that supports the I2C protocol (cannot tell the IC model number as it is not printed). For sure it supports the I2C protocol, since I wrote a code to detect it using ...
-1
votes
1answer
53 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
323 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 ...
6
votes
4answers
173 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
85 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
17 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
58 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
54 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
42 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
80 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
49 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
1answer
60 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
34 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
86 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
45 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
35 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
149 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
134 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 ...
-1
votes
1answer
114 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
63 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
139 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
122 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
249 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
77 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
41 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
85 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
408 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
71 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
142 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
107 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
57 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
515 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
138 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
82 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
55 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
2answers
124 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
59 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 ...