I know this is not a good question. But I am clueless with this error : invalid array assignment (at function convert). For extra information, I involved a lot of copying/pasting programs I haven't exactly understand from internet in the convert function (the strncpy ones) so.. yeah.
This is the program I've done (the menu/mn button currently not used):
#include <LiquidCrystal.h>
#define WORD 11
#define LETTER 15
LiquidCrystal lcd(7,6,5,4,3,2);
int i=0;
char input[] = "a";
char output[15];
const int dw = 8;
const int ri = 9;
const int le = 10;
const int up = 11;
const int ok = 12;
const int mn = 13;
int checker = 0;
int bounceCk = 0;
int bdw=0, bri=0, ble=0, beu=0, beo=0, bem=0;
void setup()
{
pinMode(dw, INPUT);
pinMode(ri, INPUT);
pinMode(le, INPUT);
pinMode(up, INPUT);
pinMode(ok, INPUT);
pinMode(mn, INPUT);
}
void intext()
{
int lim=16;
lcd.setCursor(0,1);
lcd.print(input);
for(i=0; i<lim ; )
{
lcd.setCursor(0,1);
lcd.print(input);
if(digitalRead(dw)==HIGH)
{
checker=digitalRead(dw);
delay(100);
bounceCk=digitalRead(dw);
if(checker==bounceCk)
{
if(input[i]>'z')
input[i]='a';
input[i]=input[i]+1;
}
}
if(digitalRead(up)==HIGH)
{
checker=digitalRead(up);
delay(100);
bounceCk=digitalRead(up);
if(checker==bounceCk)
{
if(input[i]<'a')
input[i]='z';
input[i]=input[i]-1;
}
}
if(digitalRead(ri)==HIGH && i<16)
{
checker=digitalRead(ri);
delay(100);
bounceCk=digitalRead(ri);
if(checker==bounceCk)
{
i=i+1;
}
}
if(digitalRead(le)==HIGH && i>0)
{
checker=digitalRead(le);
delay(100);
bounceCk=digitalRead(le);
if(checker==bounceCk)
{
i=i-1;
}
}
if(digitalRead(ok)==HIGH)
{
checker=digitalRead(ok);
delay(100);
bounceCk=digitalRead(ok);
if(checker==bounceCk)
{
lim=i;
}
}
}
}
void convert()
{
char sumber[WORD][LETTER] = {{0}}; /* declare a progmem unsigned static array of kata x huruf */
char dasar[WORD][LETTER] = {{0}}; /* declare a progmem unsigned static array of kata x huruf */
/* copy various strings to statically declared storage SUMBER */
strncpy (sumber[0],"memakan", strlen("memakan")+1);
strncpy (sumber[1],"makanan", strlen("makanan")+1);
strncpy (sumber[2],"menyuci", strlen("menyuci")+1);
strncpy (sumber[3],"perubahan", strlen("perubahan")+1);
strncpy (sumber[4],"penulisan", strlen("penulisan")+1);
strncpy (sumber[5],"tercampurkan", strlen("tercampurkan")+1);
strncpy (sumber[6],"pengelompokan", strlen("pengelompokan")+1);
strncpy (sumber[7],"pengembangan", strlen("pengembangan")+1);
strncpy (sumber[8],"kehebatan", strlen("kehebatan")+1);
strncpy (sumber[9],"memotret", strlen("memotret")+1);
strncpy (sumber[10],"melakukan", strlen("melakukan")+1);
/* copy various strings to statically declared storage DASAR*/
strncpy (dasar[0],"makan", strlen("makan")+1);
strncpy (dasar[1],"makan", strlen("makan")+1);
strncpy (dasar[2],"cuci", strlen("cuci")+1);
strncpy (dasar[3],"ubah", strlen("ubah")+1);
strncpy (dasar[4],"tulis", strlen("tulis")+1);
strncpy (dasar[5],"campur", strlen("campur")+1);
strncpy (dasar[6],"kelompok", strlen("kelompok")+1);
strncpy (dasar[7],"kembang", strlen("kembang")+1);
strncpy (dasar[8],"hebat", strlen("hebat")+1);
strncpy (dasar[9],"potret", strlen("potret")+1);
strncpy (dasar[10],"laku", strlen("laku")+1);
/* mencari input pada sumber */
int k=0, search=0, sel=9;
while(search==0)
{
sel=strcmp(input, sumber[k]);
if(sel==0)
{
output[]=dasar[k]; //!!!!THE ERROR IS HERE!!! happen to either this or output=dasar[k]
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Base Word:");
lcd.setCursor(0,1);
lcd.print(output);
search=1;
}
else
{
k=k+1;
if(k>=11)
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Error:NF");
lcd.setCursor(0,1);
lcd.print("word n found");
search=1;
}
}
}
/*
//print the values
while (*sumber[i])
printf (" %s\n", sumber[i++]);
*/
}
void loop()
{
lcd.begin(16,2);
lcd.setCursor(0,0);
lcd.print("Type your word:");
intext();
convert();
delay(15000);
}
I found more errors before, I've fixed those, but can't fix this one. I think this problem is caused by the wrong instruction or wrong format. But can't found solution...yet.
The program is converting words to its basic word in Bahasa, you can compare it to English like this. You type "eaten" and it will return "eat". You type "understood" it will return "understand". When you type "stunk" it will return "stink". Or something like that.
Example in bahasa :
"memakan" (eating) -> "makan" (eat)
"makanan" (food) -> "makan" (eat)
"pengembangan" (development) -> "kembang" (becoming bigger/better)
etc
I hope someone will give me a clear hint or two (I'm not too bright, but I still need to learn how not just copying things around), Thank you very much!