Can anyone help me turn this code into a library?
I tried myself but i keep getting errors even tho ut looks the same as the tutorial, every command and var gives me an err
if someone could make it and leave the files up thatd be greatly appreciated : )
im trying to make just one command called SIO(); that goes through the code snippet
Here's the working code just not in library for m lol
#include "LiquidCrystal.h"
LiquidCrystal lcd(30, 31, 32, 22, 23, 24, 25);
int incoming = 0;
int command[4] = {0, 0, 0, 0};
int place = 0;
int pin;
int state;
int pinstatus;
void setup(){
Serial.begin(9600);
lcd.begin(16, 2);
}
void loop(){
SIO();
}
void SIO(){
if(Serial.available() > 0){
incoming = (Serial.read());
if(incoming != 13){
lcd.print(char(incoming));
command[place] = incoming;
place = place++;
}
}
if(place >= 4){
place = 0;
pin = command[0] - 48;
pin = pin * 10;
pin += command[1] - 48;
if(command[2] == 'O') state = 1;
else;
if(command[2] == 'I') state = 0;
pinstatus = command[3] - 48;
pinMode(pin, state);
if(state == 1) digitalWrite(pin, pinstatus);
if(state == 0) Serial.println(digitalRead(pin));
}
}