Code was written based on the pseudo code written previously. Functions were used more heavily than shown in the pseudo code but this was a more streamlined approach. There was going to be a routine for calibrating the potentiometers but that was broken into a series of steps. Breaking the sequence into steps made is possible to change a couple global variables without the need to change them directly from the function.
Originally the calibrate function would move the gears to center then all the way forward and all the way backward while recording the largest and smallest potentiometer values but getting two values from a function is more difficult so the steps were divided into functions like, moveMotorToMax and moveMotorToMin. It was simple to take a potentiometer reading once the motor had been moved.
Functions were written as purely modular so they do not rely on external variables and they return any pertinent variables rather than write them directly. In other words they are reusable without having to change them.
Downloads:
Parts list:
The rest of the posts for this project have been arranged by date.
First time here?
Completed projects from year 1.
Completed projects from year 2.
Completed projects from year 3.
Disclaimer for http://24hourengineer.blogspot.com/
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All information in this blog, or linked by this blog, are not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property or similar, is the responsibility of those involved in the replication.
All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by Brian McEvoy, cannot be used to claim property or assets.
Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim claim property or assets based on their post.
This blog, including pictures and text, is copyright to Brian McEvoy.
2016-08-31 (W)
Originally the calibrate function would move the gears to center then all the way forward and all the way backward while recording the largest and smallest potentiometer values but getting two values from a function is more difficult so the steps were divided into functions like, moveMotorToMax and moveMotorToMin. It was simple to take a potentiometer reading once the motor had been moved.
Functions were written as purely modular so they do not rely on external variables and they return any pertinent variables rather than write them directly. In other words they are reusable without having to change them.
Downloads:
Parts list:
- 1 Small Arduino Micro
- 2 Stereo potentiometers (10K)
- 4 Multi-turn potentiometers (10K)
- 2 Twelve volt DC motors
- 1 Dual H-bridge
- 2 Ultrasonic distance sensors
- 1 Sine wave generator
- 1 Voltage Regulator
- 1 Twelve volt three amp power supply
The rest of the posts for this project have been arranged by date.
First time here?
Completed projects from year 1.
Completed projects from year 2.
Completed projects from year 3.
Disclaimer for http://24hourengineer.blogspot.com/
This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.
All information in this blog, or linked by this blog, are not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property or similar, is the responsibility of those involved in the replication.
All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by Brian McEvoy, cannot be used to claim property or assets.
Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim claim property or assets based on their post.
This blog, including pictures and text, is copyright to Brian McEvoy.
2016-08-31 (W)
Comments
Post a Comment