Questions tagged [arduino]

Arduino is an open-source electronics prototyping platform.

Filter by
Sorted by
Tagged with
-1
votes
1answer
70 views

How do I re-write 3 for loops into one function [closed]

I am building a color sorting machine using a Arduino uno and a TCS3200 color sensor. I have a code that is working perfectly fine however I feel like the code could be a bit more clean seeing that I ...
4
votes
2answers
63 views

Arduino project to indicate soil moisture using LEDs

I've recently started going through the Head First C book. I'd like to get up to speed in terms of writing good, idiomatic, modern C. I have read the first few chapters of the Modern C book too but ...
1
vote
1answer
59 views

Python's eval command in Arduino

I have made an equivalent of Python's "eval" command in Arduino (which in itself is quite a feat) but the part that decodes the output of it is not small enough to fit in another 30 functions since ...
1
vote
0answers
37 views

Arduino code to control motor speed based on MPU-6050 sensor

I have been trying to create arduino code where my MPU6050 reads its angle and based on that angle, change the motor speed. For example, 45° is the max motor speed, 22° is roughly half speed, and so ...
0
votes
1answer
29 views

Arduino Adafruit Motor Shield v2 wrapper for parsing text into commands

This wrapper library parses text into commands for the Adafruit Motor Shield v2 using the Regexp library. Currently, only the DC motor functions setSpeed and ...
4
votes
1answer
96 views

Vertical “moving” text on a LCD-display

Following idea: You have a LCD-display with 2 rows. You write the first line of a "text" to the second row. Then you clean the screen. After a delay you write the first line to ...
-1
votes
1answer
45 views

An interface for designing Arduino code [closed]

Writing code could be divided into three parts. 1.Interface structure At this stage programmer should describe all the devices used in his project. Of course, only those of them which Arduino ...
3
votes
1answer
46 views

Arduino: Change the color & color intensity of a LED periodically

Prerequisites: A RGB-LED is attached and wired to the Arduino Uno-board. Process description: In the beginning the LED is turned off. A loop starts and an output-signal is put on the red-part of ...
4
votes
1answer
35 views

Average readouts from multiple IR sensors with Arduino

I've written an Arduino sketch to continuously read values from multiple analog IR distance sensors, average the last 7 values and output in millimeters. Being pretty new to both Arduino and embedded ...
5
votes
2answers
155 views

Read an image with ADNS2610 optical sensor and Arduino Uno

Preliminaries I have optical sensor ADNS2610 (see datasheet here). There are a few problems which it can be used to solve, but for now let us focus on getting an image from that sensor. This sensor ...
4
votes
1answer
433 views

Basic C++ IOT Weather Station

I am making an IOT weather station based on a particle photon that sends data via webhook to one of my other projects. I am very new to c++ and programming in general. What can I do better with my ...
2
votes
1answer
64 views

Display temperature readings, with averaging

I've created a program to read temperature from 4 sensors, get an average and close/open 4 relays according to min/max values. Right now I'm trying to add a 16x2 LCD display to show those temperatures ...
1
vote
0answers
34 views

Sending AT commands via switch case in Arduino

Is this the proper use for switch case? I am looking to make a simple utility for reporting back Wireless AP info, Baud Rate, and Mode of a ESP8266 module. When the program loads it gives the user a ...
1
vote
0answers
59 views

Digital clock with many functions - follow-up

This is a follow-up from Digital clock with many functions I used the review mentioned above to optimize the code, but the code can still be made better. I made a digital clock with the use of an RTC ...
8
votes
2answers
263 views

Digital clock with many functions

I made a digital clock with the use of an RTC (DS3231) and an LCD (16x2). Current functions: Display time Display date (different formats) Display temperature (Celsius and Fahrenheit) Display day ...
2
votes
0answers
43 views

Generic prologue/epilogue for interrupt driven Atmega328P system

My thinking is that with every application, there are a few fundamentals indicative of all interrupt driven systems. Contrary to popular opinion, assembly programs can be as maintainable as HLL's, ...
1
vote
0answers
274 views

Arduino-based photo-gate timer (for physics experiments)

The purpose and operation of this program can be found within the comments. I would like feedback on my commenting style: too little? too much? too frequent? (god forbid) not frequent enough? too ...
1
vote
0answers
146 views

Matlab and WidowX robot arm communication and control

For a class, we needed to control the WidowX arm from Trossen Robotics from Matlab and get as real-time of a feedback as possible. So I came up with a code for the Arbotix Robot-controller which is ...
2
votes
1answer
688 views

Initialize union with array?

I want to create a datastructure for network communication (TCP), where I can build up a byte array from small tagged pieces (like in serialized class). And of course I need a reverse behavior of ...
1
vote
0answers
15 views

Find index of '/s' before and after text in a char array

For the Arduino programming environment, let's say I have a string literal: char strlit[17] = "_ _ _ Sup _ _ team? _ _ _" I would like to put brackets around the nth word and clear any ...
2
votes
1answer
121 views

Arduino Create and send data to Serial Port (Software Serial function)

I have this code written and functioning that will write out the chars in cmd to a serial port for an input of two int values. As the majority of the byte values ...
4
votes
0answers
218 views

A GUI program for a Buzzer system using arduino

At the outset, I am a beginner at python, having started out about 2 weeks back. Aim- To create a GUI program, that can adequately work as a buzzer-management system. A buzzer, like those used in ...
5
votes
1answer
1k views

Simon Says using Arduino UNO

I built a Simon Says game using an Arduino UNO board. This was my first "real" arduino project. I would like to know how to make it better, game mechanics and code efficiency. ...
1
vote
0answers
58 views

The ubiquitous blink program on ATmega328P

Although there is a blinking LED, the way this comes about is quite a bit different. This could be called a dead man's switch because as long as you're holding the button down, the blinking doesn't ...
5
votes
0answers
448 views

8-bit AVR delay using TIMER0 (8-bit)

Using an Atmega328P clocked externally @ 16 MHz, this procedure is analogous to delay routines that use instructions to consume clock cycles. The intent of this algorithm is not to advocate any ...
3
votes
1answer
651 views

4x4 Matrix Keypad on Arduino UNO

I recently bought a 4x4 keypad. It is one like this: http://www.learningaboutelectronics.com/images/4x4-matrix-keypad-pinout.png Now every code I found on the net was either using a highly overloaded ...
6
votes
1answer
73 views

Arduino controller to control the backlighting of a gear selector

Background The gear selector on a car allows the driver to select which state the transmission should be in. In the example picture, one of the five letters (P, R, N, D & S) lights up to ...
1
vote
0answers
66 views

Arduino sketch running on Arduino Mega as a web server

I have Arduino Mega with Ethernet shield mounted on top running as a web server. It reads temperature, humidity, rain or not and pot soil moisture and then displays on web page. Can you please review ...
1
vote
1answer
9k views

Read and write data to/from Serial Port in C#

I am building a console application which will be scheduled in Task Scheduler of Windows to run my code every day at a set hour. Summing up, this application will read and write through serial port. ...
3
votes
1answer
353 views

Reading analog moisture signal from Arduino over USB to RPi3 and publishing via paho MQTT

This program is meant to read a moisture sensor attached to an Arduino UNO board via USB to a Raspberry Pi3 which broadcasts it over MQTT. I am looking for any constructive criticism. ...
2
votes
1answer
205 views

Arduino weather station logger

I made a program that uses the Adafruit pressure sensor, and the DHT22 temperature and humidity sensor to log pressure, temperature and humidity every 30 minutes. I left it outside my house overnight ...
4
votes
1answer
162 views

Attaching an interrupt to a member function

I am making my own optical encoders. Each of them follows the exact same structure, so I figured I'd lump all the encoder processing in a class, StepCounter. ...
4
votes
2answers
2k views

Handle data sent back over serial by Arduino

I have a machine that is being controlled by an Arduino. If I send the machine the command '9' it will send back JSON with some sensor temperatures in the format ...
2
votes
1answer
85 views

Checking for automating water topoff [closed]

The purpose of this code to is check the 3 float switches in the laminator chamber for water. The float switches vote with the majority winning. A momentary switch must be pressed for the section of ...
8
votes
1answer
79 views

Process bytes and check for start key

I am working with some wireless communication in Arduino. My data will be wirelessly received like so: 97 97 97 ... ... 979797 is the address of the transmitter. ...
10
votes
1answer
487 views

Wireless Rickroll using Arduino

This is a script I made for the ESP8266 that uses the Wi-Fi chip and creates a new Access Point every 5 seconds in order to display a message on WiFi lists on nearby devices that looks like this: The ...
17
votes
1answer
646 views

Arduino Snakes and Ladders

Here is a snakes and ladders game I made using an Arduino using a serial terminal, a set of addressable LED's to create a physical game board, a 7 segment display, and a piezoelectric to create sound. ...
4
votes
2answers
625 views

Arduino code to run an LED matrix over Bluetooth

I've made an Arduino program to run on my Teensy 3.1 board. It accepts characters and strings sent to a Bluetooth module (BC417) from any Bluetooth-enabled device and uses these to power certain pins ...
1
vote
0answers
2k views

Pong game with 8x8 matrix LED display in Arduino

I was working on programming an 8x8 matrix LED display. In particular, I am trying to make a basic version of Pong, controlled by two switches, one switch for each paddle. A ball is generated and ...
1
vote
0answers
136 views

Particle Photon C++ firmware to trigger relays

I have some C++ based firmware for the Particle Photon that I've recently refactored which could do with a review, first time writing C++. Any thoughts are welcome, including design and style (I ...
3
votes
0answers
129 views

Atmega328 watchdog, sleep and external interrupts

I have a customised Arduino board that will be connected to a battery and never power reset (it needs to be very reliable and cope with code hangs). The board will always be put to sleep when not in ...
2
votes
0answers
251 views

Fetching a weather report on an Arduino from a web service

I'm writing some code which is basically supposed to http get some information from my own website and parse it, which (finally) works. However, when I compile the code, it shows this: Sketch uses ...
2
votes
0answers
202 views

Nodejs-Compass,PID,Motors-with johnny-five

I just finish coding this code which use for control robot using compass sensor with PID control to control motors. Trying to make javascript object for necessary job. Please guide me for a better ...
6
votes
2answers
128 views

Opinion on performance increase of a robot

Background A prototype of a firefighting robot has been done recently based on an Arduino microcontroller. It has two servos, one laser LED and 2WD motors. The desktop application is done in C# to ...
7
votes
1answer
1k views

Chess countdown timer for Arduino LCD Keypad

I'm very new to C++ and Arduino, with a background in Python. I've written this code for a countdown timer and a simple menu to set the time available to each player, using button handling code from ...
2
votes
1answer
423 views

7-segment 4-digit display

Is there a better way to organize the methods within this program without compromising the clarity? Running through digits 0-9 with separate functions seems very bulky. ...
2
votes
2answers
60 views

Two similar libraries for reading pin signals

I have two similar libraries for use in an embedded system (Teensy, sort of like Arduino). One is for debouncing a digital pin, the other is for reading a capacitive pin as if it is a debounced ...
3
votes
2answers
2k views

Algorithm for motion detection using ultrasonic sensor on Arduino

I am using a ultrasonic sensor to detect motion by looking at the variance of the sensor readings, however my algorithm is very prone to give false positives thus erroneously rising a motion event. ...
1
vote
2answers
767 views

Arduino microcontroller based event handler program, send sensor readings over serial bus

I am working on a project with an Arduino microcontroller and a Raspberry Pi. The code will have to do the following: If the variance calculated of the ultrasonic sensor detections exceeds 1000, a ...
4
votes
1answer
892 views

DuckyScript precompiler for Arduino Leonardo

I've made a python program to convert DuckyScript code to Arduino code for Leonardo boards. Below you can find both the project files and a sample script. ...