rework into arduino webserver

This commit is contained in:
StrangeD0s
2024-07-16 00:44:50 +02:00
parent c22b8ecdf2
commit c1d3e39f8f
+109 -836
View File
@@ -1,866 +1,139 @@
// modified for use with Sony RM-D27M
// based on https://hackaday.io/project/165504-sony-minidisc-namer by smartroad
/*
WiFi Web Server LED Blink
#include <IRremote.h> // Muss installiert werden. Funktioniert mit v2.5.0 Siehe https://github.com/Arduino-IRremote/Arduino-IRremote
#include "defines.h"
A simple web server that lets you blink an LED via the web.
This sketch will print the IP address of your WiFi Shield (once connected)
to the Serial monitor. From there, you can open that address in a web browser
to turn on and off the LED on pin 5.
IRsend irsend;
If the IP address of your shield is yourAddress:
http://yourAddress/H turns the LED on
http://yourAddress/L turns it off
char inputChars[64];
byte charCount = 0;
This example is written for a network using WPA2 encryption. For insecure
WEP or WPA, change the Wifi.begin() call and use Wifi.setMinSecurity() accordingly.
byte mode = 0; // Capitals = 0, Lowercase = 1
byte targetMode = 0;
boolean commandMode = true; // True = control playback | False = name entry mode
Circuit:
* LED attached to pin 13
* IR Transmitter attached to pin 4
int totalCount = 0;
byte blockCount = 0;
created for arduino 25 Nov 2012
by Tom Igoe
// define the IT sendPin:
uint8_t tSendPin = 4; // IO4 auf AZ D1
ported for sparkfun esp32
31.01.2017 by Jan Hendrik Berlin
/* start testing code for hardware button*/
// constants won't change. They're used here to set pin numbers:
uint8_t buttonPin = 14; // the number of the pushbutton pin
uint8_t ledPin = 2; // the number of the LED pin
*/
// variables will change:
uint8_t buttonState = 0; // variable for reading the pushbutton status
/* end testing code */
#include <WiFi.h>
#include <IRremote.hpp>
const char* ssid = "FritzBox-7590-NB";
const char* password = "60762265561727730801";
WiFiServer server(80);
void setup()
{
pinMode(2, OUTPUT);
// Initialize serial monitor:
Serial.begin(115200);
while (!Serial)
;
// helpText();
pinMode(tSendPin, OUTPUT);
digitalWrite(tSendPin, LOW);
/* start testing code */
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
digitalWrite(ledPin, HIGH);
/* end testing code */
pinMode(13, OUTPUT); // set the LED pin mode
delay(10);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// Here the macro IR_SEND_PIN is not defined or undefined above with #undef IR_SEND_PIN
uint8_t tSendPin = 4;
IrSender.begin(tSendPin, ENABLE_LED_FEEDBACK, USE_DEFAULT_FEEDBACK_LED_PIN); // Specify send pin and enable feedback LED at default feedback LED pin
// You can change send pin later with IrSender.setSendPin();
Serial.println();
Serial.print(F("Send IR signals at pin "));
Serial.println(tSendPin);
Serial.println();
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop()
{
// blink(); //! Der Loop wird gerade nur einmal ausgeführt und stoppt bei der serial monitor eingabe. Bei jeder Eingabe erfolgt ein neue Loop. Alle test-Funktionen laufen durch.
// simpleButtonTest();
buttonPlayTest();
// oldSerialInput();
}
void simpleButtonTest()
{
/* start testing code */
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
void loop(){
WiFiClient client = server.available(); // listen for incoming clients
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH)
{
// write to serial monitor:
Serial.println(F("button state is HIGH"));
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else
{
// turn LED off:
digitalWrite(ledPin, LOW);
}
/* end testing code */
}
if (client) { // if you get a client,
Serial.println("New Client."); // print a message out the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected()) { // loop while the client's connected
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
if (c == '\n') { // if the byte is a newline character
void buttonPlayTest()
{
/* start testing code */
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH)
{
// write to serial monitor:
Serial.println(F("button state is HIGH"));
// turn LED on:
digitalWrite(ledPin, HIGH);
Serial.println(F("Play"));
sendButton(PLAY);
}
else
{
// turn LED off:
digitalWrite(ledPin, LOW);
}
/* end testing code */
}
// the content of the HTTP response follows the header:
client.print("Click <a href=\"/H\">here</a> to turn the LED on pin 13 on.<br>");
client.print("Click <a href=\"/L\">here</a> to turn the LED on pin 13 off.<br>");
client.print("<a href=\"/play\">play</a><br>");
client.print("<form action=\"/api/control-deck\" method=\"post\"><button name=\"control\" type=\"submit\" value=\"play\">play</button></form><br>");
client.print("<form action=\"/api/control-deck\" method=\"get\"><input name=\"textinput\" type=\"text\" /></form><br>");
void oldSerialInput()
{
if (commandMode)
{
if (charCount > 0)
{
Serial.println(F("\n\r\u001b[34;1mCONFIRM NAME INPUT\u001b[0m"));
Serial.println(F("Y - Yes or N - NO"));
}
else
{
Serial.print(F("\n\r\n\rEnter Command (H for help): "));
// The HTTP response ends with another blank line:
client.println();
// break out of the while loop:
break;
} else { // if you got a newline, then clear currentLine:
currentLine = "";
}
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}
while (!Serial.available())
{
// Check to see if the client request was "GET /H" or "GET /L":
if (currentLine.endsWith("GET /H")) {
digitalWrite(13, HIGH); // GET /H turns the LED on
}
if (currentLine.endsWith("GET /L")) {
digitalWrite(13, LOW); // GET /L turns the LED off
}
if (currentLine.endsWith("GET /play")) {
Serial.println("MD play");
Serial.flush();
IrSender.sendSony(0xF, 0x2A, 2, 12);
}
if (currentLine.endsWith("POST /api/control-deck")) {
if (commandMode)
{
char serialChar = Serial.read();
if (charCount == 0)
{
if (serialChar == 'b')
{
Serial.println(F("Next Track"));
sendButton(AMSNEXT);
}
else if (serialChar == 'z')
{
Serial.println(F("Previous Track"));
sendButton(AMSPREV);
}
else if (serialChar == 'x')
{
Serial.println(F("Play"));
sendButton(PLAY);
}
else if (serialChar == 'c')
{
Serial.println(F("Pause"));
sendButton(PAUSE);
}
else if (serialChar == 'v')
{
Serial.println(F("Stop"));
sendButton(STOP);
}
else if (serialChar == 'l')
{
Serial.println(F("Eject"));
sendButton(EJECT);
}
else if (serialChar == 's')
{
Serial.println(F("Starting Record"));
sendButton(RECORD);
}
else if (serialChar == 'S')
{
Serial.println(F("Music Sync Recording"));
sendButton(MUSICSYNC);
}
else if (serialChar == 'd')
{
Serial.println(F("Display Mode"));
sendButton(DISPLAY);
}
else if (serialChar == 'D')
{
Serial.println(F("Scrolling Display"));
sendButton(SCROLL);
}
else if (serialChar == 'r')
{
Serial.println(F("Repeat Mode"));
sendButton(REPEATMODE);
}
else if (serialChar == 'R')
{
Serial.println(F("Section Repeat (A<>B)"));
sendButton(ATOB);
}
else if (serialChar == '1')
{
Serial.print(F("1"));
// sendButton(NUMBER1);
digitalWrite(ledPin, HIGH);
Serial.print(F("set ledPin HIGH"));
}
else if (serialChar == '2')
{
Serial.print(F("2"));
// sendButton(NUMBER2);
digitalWrite(ledPin, LOW);
Serial.print(F("set ledPin LOW"));
}
else if (serialChar == '3')
{
Serial.print(F("3"));
sendButton(NUMBER3);
}
else if (serialChar == '4')
{
Serial.print(F("4"));
sendButton(NUMBER4);
}
else if (serialChar == '5')
{
Serial.print(F("5"));
sendButton(NUMBER5);
}
else if (serialChar == '6')
{
Serial.print(F("6"));
sendButton(NUMBER6);
}
else if (serialChar == '7')
{
Serial.print(F("7"));
sendButton(NUMBER7);
}
else if (serialChar == '8')
{
Serial.print(F("8"));
sendButton(NUMBER8);
}
else if (serialChar == '9')
{
Serial.print(F("9"));
sendButton(NUMBER9);
}
else if (serialChar == '0')
{
Serial.print(F("0"));
sendButton(NUMBER10);
}
else if (serialChar == '=' || serialChar == '+')
{
Serial.print(F(">10"));
sendButton(LARGER25);
}
else if (serialChar == '#')
{
Serial.print(F("CLEARING MEMUSAGE"));
totalCount = 0;
blockCount = 0;
memUsed();
}
else if (serialChar == '`')
{ // change to naming mode
Serial.println(F("Name Mode"));
commandMode = false;
memUsed();
Serial.println(F("\n\rType name and press enter to send:\u001b[37;1m"));
}
else if (serialChar == 'H' || serialChar == 'h')
{ // stop
Serial.println(F("Help\r\n\r\n"));
helpText();
}
}
else
{
if (serialChar == 'Y' || serialChar == 'y')
{ // confirm name
totalCount += charCount;
blockCount += (charCount + 6) / 7;
memUsed();
charCount = 0;
sendButton(NAME);
}
else if (serialChar == 'N' || serialChar == 'n')
{ // cancel name
memUsed();
charCount = 0;
sendButton(STOP);
Serial.println("POST");
char c = client.read();
Serial.print(c);
}
}
}
else
{
inputChars[charCount] = Serial.read();
if (inputChars[charCount] == 10 || inputChars[charCount] == 13)
{
Serial.print(F("\u001b[0m"));
if (nameCheck())
sendName();
else
charCount = 0;
commandMode = true;
}
else if (inputChars[charCount] == 127)
{
Serial.print(inputChars[charCount]);
charCount--;
}
else
{
Serial.print(inputChars[charCount]);
charCount++;
}
// close the connection:
client.stop();
Serial.println("Client Disconnected.");
}
}
void memUsed()
{
float countPercent = (float(totalCount) / 1785) * 100;
float blockPercent = (float(blockCount) / 255) * 100;
Serial.print(F("\n\rTotal characters used: \u001b[1m"));
if (countPercent >= 75 && countPercent < 90)
Serial.print(F("\u001b[33m"));
else if (countPercent >= 90)
Serial.print(F("\u001b[31m"));
else
Serial.print(F("\u001b[32m"));
Serial.print(countPercent);
Serial.print(F("%\u001b[0m\u001b[0m\n\rTotal blocks used: \u001b[1m"));
if (blockPercent >= 75 && blockPercent < 90)
Serial.print(F("\u001b[33m"));
else if (blockPercent >= 90)
Serial.print(F("\u001b[31m"));
else
Serial.print(F("\u001b[32m"));
Serial.print(blockPercent);
Serial.print(F("%\u001b[0m\n\r"));
}
void sendName()
{
Serial.println(F("\n\r\n\rActivating Name Edit on Player - \u001b[31mPress any key when player ready\u001b[0m"));
sendButton(NAME);
mode = 0;
targetMode = 0;
// delay(2000);
while (!Serial.available())
{
}
char purge = Serial.read(); // dump the character
Serial.print(F("\n\rSending: \u001b[32;1m"));
for (byte c = 0; c < charCount; c++)
{
if (inputChars[c] >= 65 && inputChars[c] <= 90)
{ // Check if char is capital and switch to correct mode
targetMode = 0;
}
else if (inputChars[c] >= 97 && inputChars[c] <= 122)
{ // Check if char is lower and switch to correct mode
targetMode = 1;
}
while (mode != targetMode)
{
sendButton(CHAR);
delay(1000);
mode++;
if (mode > 1)
mode = 0;
}
if (inputChars[c] == 'A')
{
Serial.print(inputChars[c]);
sendCmd(CONTINUE, 1);
}
else if (inputChars[c] == 'B')
{
Serial.print(inputChars[c]);
sendCmd(SHUFFLE, 1);
}
else if (inputChars[c] == 'C')
{
Serial.print(inputChars[c]);
sendCmd(PROGRAM, 1);
}
else if (inputChars[c] == 'D')
{
Serial.print(inputChars[c]);
sendCmd(KEY_D, 1);
}
else if (inputChars[c] == 'E')
{
Serial.print(inputChars[c]);
sendCmd(KEY_E, 1);
}
else if (inputChars[c] == 'F')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER1, 1);
}
else if (inputChars[c] == 'G')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER2, 1);
}
else if (inputChars[c] == 'H')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER3, 1);
}
else if (inputChars[c] == 'I')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER4, 1);
}
else if (inputChars[c] == 'J')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER5, 1);
}
else if (inputChars[c] == 'K')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER6, 1);
}
else if (inputChars[c] == 'L')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER7, 1);
}
else if (inputChars[c] == 'M')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER8, 1);
}
else if (inputChars[c] == 'N')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER9, 1);
}
else if (inputChars[c] == 'O')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER10, 1);
}
else if (inputChars[c] == 'P')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER11, 1);
}
else if (inputChars[c] == 'Q')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER12, 1);
}
else if (inputChars[c] == 'R')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER13, 1);
}
else if (inputChars[c] == 'S')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER14, 1);
}
else if (inputChars[c] == 'T')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER15, 1);
}
else if (inputChars[c] == 'U')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER16, 1);
}
else if (inputChars[c] == 'V')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER17, 1);
}
else if (inputChars[c] == 'W')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER18, 1);
}
else if (inputChars[c] == 'X')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER19, 1);
}
else if (inputChars[c] == 'Y')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER20, 1);
}
else if (inputChars[c] == 'Z')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER21, 1);
}
else if (inputChars[c] == 'a')
{
Serial.print(inputChars[c]);
sendCmd(CONTINUE, 1);
}
else if (inputChars[c] == 'b')
{
Serial.print(inputChars[c]);
sendCmd(SHUFFLE, 1);
}
else if (inputChars[c] == 'c')
{
Serial.print(inputChars[c]);
sendCmd(PROGRAM, 1);
}
else if (inputChars[c] == 'd')
{
Serial.print(inputChars[c]);
sendCmd(KEY_D, 1);
}
else if (inputChars[c] == 'e')
{
Serial.print(inputChars[c]);
sendCmd(KEY_E, 1);
}
else if (inputChars[c] == 'f')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER1, 1);
}
else if (inputChars[c] == 'g')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER2, 1);
}
else if (inputChars[c] == 'h')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER3, 1);
}
else if (inputChars[c] == 'i')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER4, 1);
}
else if (inputChars[c] == 'j')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER5, 1);
}
else if (inputChars[c] == 'k')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER6, 1);
}
else if (inputChars[c] == 'l')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER7, 1);
}
else if (inputChars[c] == 'm')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER8, 1);
}
else if (inputChars[c] == 'n')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER9, 1);
}
else if (inputChars[c] == 'o')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER10, 1);
}
else if (inputChars[c] == 'p')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER11, 1);
}
else if (inputChars[c] == 'q')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER12, 1);
}
else if (inputChars[c] == 'r')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER13, 1);
}
else if (inputChars[c] == 's')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER14, 1);
}
else if (inputChars[c] == 't')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER15, 1);
}
else if (inputChars[c] == 'u')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER16, 1);
}
else if (inputChars[c] == 'v')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER17, 1);
}
else if (inputChars[c] == 'w')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER18, 1);
}
else if (inputChars[c] == 'x')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER19, 1);
}
else if (inputChars[c] == 'y')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER20, 1);
}
else if (inputChars[c] == 'z')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER21, 1);
}
else if (inputChars[c] == 39 || inputChars[c] == 96)
{ // ' and `
Serial.print(inputChars[c]);
sendCmd(NUMBER25, 1);
}
else if (inputChars[c] == 45 || inputChars[c] == 95)
{ // - or _
Serial.print(inputChars[c]);
sendCmd(NUMBER22, 1);
}
else if (inputChars[c] == 47 || inputChars[c] == 92)
{ // slash or backslash
Serial.print(inputChars[c]);
sendCmd(LARGER25, 1);
}
else if (inputChars[c] == 44)
{ // , not supported
Serial.print(inputChars[c]);
sendCmd(NUMBER1, 1);
}
else if (inputChars[c] == '.')
{
Serial.print(inputChars[c]);
sendCmd(NUMBER24, 1);
}
else if (inputChars[c] == '(')
{
Serial.print(inputChars[c]);
sendCmd(ASPACE, 1);
}
else if (inputChars[c] == ')')
{
Serial.print(inputChars[c]);
sendCmd(MSCAN, 1);
}
else if (inputChars[c] == ':')
{ // : not supported
Serial.print(inputChars[c]);
sendCmd(NUMBER1, 8);
}
else if (inputChars[c] == '!')
{
Serial.print(inputChars[c]);
sendCmd(ATOB, 1);
}
else if (inputChars[c] == '?')
{
Serial.print(inputChars[c]);
sendCmd(REPEATMODE, 1);
}
else if (inputChars[c] == '1')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER1, 1);
}
else if (inputChars[c] == '2')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER2, 1);
}
else if (inputChars[c] == '3')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER3, 1);
}
else if (inputChars[c] == '4')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER4, 1);
}
else if (inputChars[c] == '5')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER5, 1);
}
else if (inputChars[c] == '6')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER6, 1);
}
else if (inputChars[c] == '7')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER7, 1);
}
else if (inputChars[c] == '8')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER8, 1);
}
else if (inputChars[c] == '9')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER9, 1);
}
else if (inputChars[c] == '0')
{
Serial.print(inputChars[c]);
sendNumCmd(NUMBER10, 1);
}
else if (inputChars[c] == ' ')
{ // space
Serial.print(inputChars[c]);
sendCmd(NUMBER23, 1);
}
}
Serial.print(F("\u001b[0m\n\r\n\rTotal characters needed: "));
Serial.print(charCount);
Serial.print(F("\n\rTotal blocks needed: "));
Serial.print((charCount + 6) / 7);
Serial.print(F("\n\r"));
}
void sendCmd(int command, byte repeats)
{
for (int i = 0; i <= repeats - 1; i++)
{
sendButton(command);
delay(100);
}
}
void sendButton(int bts)
{
digitalWrite(tSendPin, HIGH);
for (int i = 0; i < 3; i++)
{
irsend.sendSony(bts, 12); //! Hier wird das Command gesendet! Es besteht aus dem command und der bitlänge.
delay(25);
}
digitalWrite(tSendPin, LOW);
}
void sendNumCmd(int command, byte repeats)
{
for (int i = 0; i <= repeats - 1; i++)
{
sendButton(NUM);
delay(1000);
sendButton(command);
delay(100);
sendButton(NUM);
delay(1000);
}
}
void helpText()
{
Serial.print(F("\u001b[1m\u001b[7mMinidisc Namer\u001b[0m\n\r\
\n\r\
\u001b[1mCommands:\u001b[0m\n\r\
\n\r\
\u001b[32mGeneral:\n\r\
\u001b[0mz Previous Track\n\r\
x Play\n\r\
c Pause\n\r\
v Stop\n\r\
b Next Track\n\r\
l Eject\n\r\
\n\r\
\u001b[31mRecording:\n\r\
\u001b[0ms Record\n\r\
S Music Sync Recording\n\r\
i Input Selection\n\r\
q Recording Mode\n\r\
\n\r\
\u001b[33mNumbers:\n\r\
\u001b[0m0-9 Number Entry\n\r\
=/+ >10 Entry\n\r\
\n\r\
\u001b[34;1mDisplay:\n\r\
\u001b[0md Display\n\r\
D Scroll Display\n\r\
\n\r\
\u001b[36mPlaymodes/Repeating:\n\r\
\u001b[0mp Play Mode (Normal/Shuffle/Program)\n\r\
r Repeat\n\r\
R A <-> B\n\r\
\n\r\
\u001b[32;1mNaming Disc/Tracks:\n\r\
\u001b[0m` Name Entry Mode\n\r\
# Reset Memory Usage Stats\n\r\
\n\r\
\u001b[37;1mh This help list\u001b[0m\n\r\n\r"));
}
boolean nameCheck()
{
Serial.print(F("\n\r\n\r\n\rSend this to player (Y/N):\n\r\u001b[37;1m"));
for (byte c = 0; c < charCount; c++)
{
Serial.print(inputChars[c]);
}
Serial.print(F("\n\r\u001b[0m"));
while (!Serial.available())
{
}
char serialChar = Serial.read();
if (serialChar == 'Y' || serialChar == 'y')
return 1;
else
return 0;
}
void blink()
{
/* start testing code */
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH)
{
// write to serial monitor:
Serial.println(F("button state is HIGH"));
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else
{
// turn LED off:
digitalWrite(ledPin, LOW);
}
/* end testing code */
Serial.print(F("blink"));
// digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level)
// delay(1000); // wait for a second
// digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW
// delay(1000);
}