So I came up with a project and fingered out all the hardware for it. I am good there but when it comes to the code that is where a made the big mistake. I thought I had it all worked out in my head on how the code should go. After putting pen to paper I realized it is not going to be as simple as I thought.
Here is the general hardware, minus the small stuff.
Arduino Uno (clone), LCD screen, 3x 10k pots, 2x motors.
The pots control three basic functions, motor on time (in seconds), motor off time(in minutes), and motor power level(in ten levels, 1-10).
The LCD displays four different pieces of information. the motor on time, motor off time, motor power level, and the number of times it has cycled through on and off.
Once I realized the serval mistakes I made I stopped writing the code and jumped on here to see if I can get some major help.
I have also included a picture I made to help me get the LCD pattern right. The top row and left column are the position numbers when I write the code. The # is where the variable goes to be displayed.
This is my first project so please go easy on me. Thank you in advance.
#include <LiquidCrystal.h> //16x2 LCD libary priveded by LCD manufactor.
//Setup of Pins.
const int timeOn = A1; // 10k pot
const int timeOff = A2; // 10k pot
const int power = A3; // 10k pot
const int motorOne = 9; // output to motor 1
const int motorTwo = 10; // output to motor 2
//setting up variables to hold pot numbers.
int timeOn_var = 0;
int timeOff_var = 0;
int power_var = 0;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void setup()
{
pinMode(timeOn, INPUT);
pinMode(timeOff, INPUT);
pinMode(power, INPUT);
pinMode(motorOne, OUTPUT);
pinMode(motorTwo, OUTPUT);
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.println("OFF-T:");
lcd.setCursor(0,1);
lcd.println("ON-T:");
lcd.setCursor(11,0);
lcd.println("P:");
lcd.setCursor(11,1);
lcd.println("C:");
}
void loop()
{
map(timeOn_var,0,1024,0,10); //seconds
map(timeOff_var,0,1024,0,10); //Minutes
maps(power_var,0,1024,0,255); //power levels
analogWrite(motorOne,power_var);
analogWrite(motorTwo,power_var);
delay(timeOn_var);
analogWrite(motorOne,0);
analogWrite(motorTwo,0);
delay(timeOff_var);
}

