Hi,
I'm fairly new to Arduino and I was trying out some stuff, and I happened to try this out but it does not do what its supposed to. I expect it to read the charecter at every index value and change the brightness accordingly every 1 second. However the brightness of the LED remains constant throughout. Any suggestions?
#include <Wire.h>
#include <Servo.h>
#include <seeed-kit.h>
#include <math.h>
char text[] = {"AZZA"};
void PassTextToLaser(char theText[]);
int Length = (sizeof(text)/sizeof(text[0]));
int Laser = 11;
int main() {
init();
lcdInit();
PassTextToLaser(text);
return 0;
}
void PassTextToLaser(char theText[])
{
int ArrayForLaser[]= {};
for( int i = 0; i < Length; i++)
{
if ( theText[i] == 'A')
{
ArrayForLaser[i]= 25;
}
else if ( theText[i] == 'B')
{
ArrayForLaser[i]= 66;
}
else if ( theText[i] == 'C')
{
ArrayForLaser[i]= 67;
}
else if ( theText[i] == 'D')
{
ArrayForLaser[i]= 68;
}
else if ( theText[i] == 'E')
{
ArrayForLaser[i]= 69;
}
else if ( theText[i] == 'F')
{
ArrayForLaser[i]= 70;
}
else if ( theText[i] == 'G')
{
ArrayForLaser[i]= 71;
}
else if ( theText[i] == 'H')
{
ArrayForLaser[i]= 72;
}
else if ( theText[i] == 'I')
{
ArrayForLaser[i]= 73;
}
else if ( theText[i] == 'J')
{
ArrayForLaser[i]= 74;
}
else if ( theText[i] == 'K')
{
ArrayForLaser[i]= 75;
}
else if ( theText[i] == 'L')
{
ArrayForLaser[i]= 76;
}
else if ( theText[i] == 'M')
{
ArrayForLaser[i]= 77;
}
else if ( theText[i] == 'N')
{
ArrayForLaser[i]= 78;
}
else if ( theText[i] == 'O')
{
ArrayForLaser[i]= 79;
}
else if ( theText[i] == 'P')
{
ArrayForLaser[i]= 80;
}
else if ( theText[i] == 'Q')
{
ArrayForLaser[i]= 81;
}
else if ( theText[i] == 'R')
{
ArrayForLaser[i]= 82;
}
else if ( theText[i] == 'S')
{
ArrayForLaser[i]= 83;
}
else if ( theText[i] == 'T')
{
ArrayForLaser[i]= 84;
}
else if ( theText[i] == 'U')
{
ArrayForLaser[i]= 85;
}
else if ( theText[i] == 'V')
{
ArrayForLaser[i]= 86;
}
else if ( theText[i] == 'W')
{
ArrayForLaser[i]= 87;
}
else if ( theText[i] == 'X')
{
ArrayForLaser[i]= 88;
}
else if ( theText[i] == 'Y')
{
ArrayForLaser[i]= 89;
}
else if ( theText[i] == 'Z')
{
ArrayForLaser[i]= {255};
}
analogWrite(Laser,ArrayForLaser[i]);
delay(1000);
}
}
Project1.1.ino (2.43 KB)