hi
I am getting "expected initializer before 'char'" and the following line is highlighted
char *myArray[] = ("Stat", "Inv", "Data", "Map", "Radio"};
It is the beginning of a menu system for a as-functional-as-i-can-make pipboy prop for a costume.
Trying to get the first simplest line working first before tackling the bigger secondary and yet even bigge rtertiary level menus.
Arduino mega with tft lcd screen.
rotary knobs feeding into analog pins using voltage divider arraingment to select the signal strength going onto the analog pins (and mapped to determine what is currently selected at each level)
/* The script i wrote to test resisters to find the right values for the pipboy selector switches output to serial port.
Here I add support to use the pipboy tft lcd screen as well to help suss out coding for it. */
int aPin = 15; //set analog pin
int aRange = 5; // set top number for map to
int bPin = 13; //set analog pin
int bRange = 6; // set top number for map to
int cPin = 14; //set analog pin
int cRange = 7; // set top number for map to
#include<Adafruit_GFX.h>; // load libraries
#include<Fonts/FreeSans9pt7b.h>;
#include<MCUFRIEND_kbv.h> // hardware specific library for my tftlcd screen
MCUFRIEND_kbv tft;
uint16_t iD
#define Green 0x07E0; // define colours uded
#define black 0x000;
#define white 0x8410;
char *myArray[] = ("Stat", "Inv", "Data", "Map", "Radio"};
void setup() {
// put your setup code here, to run once:
tft.reset();
iD = tft.readID();
tft.begin(iD);
pinMode(aPin, INPUT); // sets analog pin to be input
pinMode(bPin, INPUT);
pinMode(cPin, INPUT);
Serial.begin(9600);
tft.setRotation (1);
tft.fillScreen(black);
}
void loop() {
// put your main code here, to run repeatedly:
tft.setFont (&FreeSans9pt7b); // set up colour, font and text size
tft.setTextColor (Green);
tft.setTextSize (1);
int aRaw = analogRead(aPin); // read analog input
int aAdjusted = map(aRaw, 0, 1023, 1, 6); //aAdjusted = mapped value of input
int bRaw = analogRead(bPin); // read analog input
int bAdjusted = map(bRaw, 0, 1023, 1, 6); //aAdjusted = mapped value of input
int cRaw = analogRead(cPin); // read analog input
int cAdjusted = map(cRaw, 0, 1023, 1, 6); //aAdjusted = mapped value of input
tft.setCursor (219, 15);
tft.fillRect(205, 0, 55, 24, black); // blank out value to print
tft.setCursor (2, 15);
tft.print (myArray[0]);
tft.setCursor (75, 15); // first line of text
tft.print (myArray[1]);
tft.setCursor (140, 15);
tft.print (myArray[2]);
tft.setCursor (205, 15);
tft.print myArray[3];
tft.setCursor (260, 15);
tft.print (myArray[4]);
tft.drawLine (1, 25, 319, 25, Green);
//Serial.print ("Adjusted mapped value =");
//Serial.println (aAdjusted);
tft.fillRect(205, 27, 22, 23, black); // blank out value to print
tft.setCursor (75, 42); // first line of text
tft.print ("Mapped");
tft.setCursor (147, 42);
tft.print ("adjust");
tft.setCursor (205, 42);
tft.print (aAdjusted);
tft.drawLine (1, 50, 319, 50, Green);
delay(2000); // delay to enable display to be read.
}