So my project is about parking guidance system where I am required to tell user whether or not parking slots on a parking space is available. For my project I have 15 spaces I have no idea on how to fix my Arduino code, I already have my app finished but I don’t know how to fix my coding, can anyone please help guide me through this? Much thanks
edit: I am using MIT App Inventor
#include<SoftwareSerial.h>
#define TxD 18
#define RxD 19
SoftwareSerial bluetoothSerial(TxD, RxD);
//include the library code
#include<LiquidCrystal.h>
//initialize library with the numbers of the interface pins
LiquidCrystal lcd(38,36,34,32,30,28);
//pins used for Light Dependent Resistor (ldr)
const int ldrPin[] = {A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14};
//pins used for Light Emitting Diode (LED)
const int ledPin[] = {2,3,4,5,6,7,8,9,10,11,12,13,22,24,26};
int ldrStatus[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14}; //used to store readings from LDR
void setup() {
Serial.begin(9600);
bluetoothSerial.begin(9600)
lcd.begin(16,2); //set up LCD's number of rows and columns
lcd.print("Available Parking =" );
//declare LED as output
for(int n=0; n<15 ; n++)
{
pinMode(ledPin[n],OUTPUT);
}
}
void loop() {
int slot[14];
for (byte n = 0; n<15 ; n++) {
ldrStatus[n] = analogRead(ldrPin[n]);
ldrStatus[n] = analogRead(ldrPin[n]);
//Availability of parking slots
if (ldrStatus[n] >=200) {
digitalWrite(ledPin[n], HIGH); //turn LED on
slot[n] = 1; }
else {
digitalWrite(ledPin[n], LOW);
slot[n] = 0;}
}
int ParkingAvailable = 0;
for (int i = 0; i <15 ; i++){
ParkingAvailable = ParkingAvailable + slot[i];
}
lcd.setCursor(0,1);
lcd.print(ParkingAvailable);
Serial.println(ParkingAvailable);
delay(1000);
}