Questions tagged [algorithm]
An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.
21 questions
2
votes
2
answers
667
views
How do I find the whole number (n) that when multiplied by (m) will be closest to (x)? [closed]
I've designed an apparatus that uses stepper motors, and they are linked together so that when armature A turns, it consequently moves armature B by a ratio of 1/4. In order to keep armature B in the ...
1
vote
0
answers
64
views
Need help with debugging a heartrate/filter code (the heart rate calculation does not work)
The code below is a program that aims to apply the Pans-Thompskin algorithm to a signal attained from a ECG filter. The filter seems to work alright but it fails to blink the LED and collect a correct ...
1
vote
2
answers
669
views
Using millis() instead of delay() when playing a melody
I want to make my Arduino to play several simple melodies, and also be able to skip a melody by pressing a button and go on with the next song. therefore I cannot use delay() because the code should ...
2
votes
2
answers
970
views
Maze solving robot turning failure due to sensor distance to the corner increasing during the turn
At my school we have a project where we have to make a robot that can solve a 3D-maze using an arduino controlled robot that uses ultrasonic sensors to determine how to turn. The robot may not be pre-...
2
votes
0
answers
96
views
Reliably using analogRead as a compact digitalRead
My goal is to reduce pins being used for micro-controllers with limited pins, or projects requiring a few different digital input values.
How I intend to do so is by using ADC pins to gather four ...
1
vote
0
answers
64
views
Port manipulation: Coding for two chips
I am using Arduino Nano to test a code that will be ported on an ATTiny chip, which will need to perform operations at a frequency near clock maximum, calling for a very succinct coding.
My goal: to ...
1
vote
2
answers
6k
views
Using I2C: Master Reader and Writer
I'm using I2C and the Arduino Library (Wire) to communicate between two Arduinos, and my code isn't working. It's supposed to read in an int from the slave, write a value to the slave, then read back ...
0
votes
1
answer
116
views
Built-In Digital Map for Robot Driving
So, I'm creating this project for school. It's a simple robot with Arduino MEGA 2560 and basically, I create a digital map, feed it into the Arduino program and then the robot can drive. However, I've ...
3
votes
3
answers
3k
views
Algorithms to reduce measurement error from analogue sensors
When reading analogue sensors - e.g. load cells, accelerometers - via a microcontroller's Analogue to Digital Converter, there are many sources of potential measurement error including:
a) Warm-up ...
0
votes
1
answer
1k
views
Algorithm to detect motion using ultrasonic sensor
I have a PIR sensor which sometimes give false readings and I have added a ultrasonic sensor to compensate for that. I think my algorithm can work, however currently it is very prone to give false ...
0
votes
1
answer
133
views
Call function and not came back
Im having a little problem with my code. here i called a function to make a test, if it passed it goes back and continue if it doesn't it goes to main loop.
void loop()
{
if (call == 1)
{
...