I am currently writing an elevator simulator code for a project that I am making, I ended up getting a bit of help for how to set the code up. The issue is, I don't know what I am doing. Any help will be appreciated
Here is the code that I am writing
int CurrentPos = 1; // Starting Position of the elevator
int Calls[] = {0,0,0,0}; // Call Button Data Storage **DO NOT MESS WITH!!**
int NextFloor = 1;
int Directions = 0; //0 = down, 1 = n 2 = up
int TRAVEL_TIME = 2000;
const int Buttons[] = {2,3,4,5}; //Button Pin Reference
const int PressedLED[] = {6,7,8,9}; // Button LED Reference
const int MovingLED[] = {10,11,12,13};
void setup() {
//Button Input Setup
for (int i = 0; i = 3; i++){
pinMode (Buttons[i], INPUT_PULLUP);
}
//Pressed LED Setup
for (int i = 0; i = 3; i++){
pinMode(PressedLED[i], OUTPUT);
}
//Moving LED Setup
for (i = 0l i = 3; i++){
pinMode(MovingLED[i], OUTPUT);
}
}
void loop() {
//Are there any calls?
//Ifbutton 1,2,3,4
//Calls[button -1] =1
//Button LED
//What floor to next
//Cur = next
//Get next floor based on Calls
//If traveling for the first time
//counter = 0;
//else not
//counter++
//If counter = TAVEL TIME
//counter =0
//curent possition to +/- 1 floor based on direction
}
First of all you should add the "chrystal ball"-module to your µC that can beam pictures of your imagination into the forum-members head to understand what you want to add.
Oh you don't know where to buy the "chrystal ball"-module ??
Me not either!
So maybe describing in detail what functionality you want to add is a good solution.