Hello i am programing arduino but i have a little problem.
so Here is my part of my code:
Code:
void play_game(char *secret)
{
char **history;
char *guess;
int pokus = 0;
int peg_a;
int peg_b;
int Chistory = 0;
guess[0] = 0;
guess[1] = 1;
guess[2] = 2;
guess[3] = 3;
char *k = (char *) guess[0];
turn_off_leds();
lcd_clear();
lcd_print_at(1, 2, "Welcome");
lcd_print_at(1, 2, "Your goal");
while (true) {
delay(100);
if (digitalRead(BTN_ENTER_PIN == HIGH)) {
break;
}
}
lcd_clear();
lcd_print_at(0, 1, "I think");
lcd_print_at(0, 2, "Your ate");
lcd_print_at(12, 2, k);
lcd_print_at(13, 2, guess[1]);
lcd_print_at(14, 2, guess[2]);
lcd_print_at(15, 2, guess[3]);
while (true) {
if (digitalRead(BTN_1_PIN) == HIGH &&
digitalRead(BTN_2_PIN) == LOW &&
digitalRead(BTN_3_PIN) == LOW && digitalRead(BTN_4_PIN) == LOW) {
if (guess[0] == 9) {
guess[0] = 0;
} else {
guess[0]++;
}
lcd_print_at(12, 2, (char *) guess[0]);
lcd_print_at(13, 2, guess[1]);
lcd_print_at(14, 2, guess[2]);
lcd_print_at(15, 2, guess[3]);
lcd_print_at is declared:
Code:
void lcd_print(char *text) {
Serial.print(text);
lcd.print(text);
}
void lcd_print_at(int y, int x, char *text) {
lcd_set_cursor(y, x);
lcd_print(text);
}
and my error look like this:
Code:
src\master.cpp:178:31: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
lcd_print_at(1,2,"Welcome");
^
src\master.cpp:179:33: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
lcd_print_at(1,2,"Your goal");
^
src\master.cpp:191:30: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(13,2,guess[1]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:192:30: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(14,2,guess[2]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:193:30: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(15,2,guess[3]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:206:45: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
lcd_print_at(12,2,(char*)guess[0]);
^
src\master.cpp:207:38: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(13,2,guess[1]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:208:38: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(14,2,guess[2]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:209:38: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(15,2,guess[3]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:223:38: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(12,2,guess[0]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:224:38: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(13,2,guess[1]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:225:38: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(14,2,guess[2]);
^
In file included from src\master.cpp:2:0:
src\lcd_wrapper.h:50:6: note: initializing argument 3 of 'void lcd_print_at(int, int, char*)'
void lcd_print_at(int y, int x,char* text);
^
src\master.cpp:226:38: warning: invalid conversion from 'char' to 'char*' [-fpermissive]
lcd_print_at(15,2,guess[3]);
I dont know what i am doing wrong. Can you help me with my code?