Hello,
I want to print values of data i transfer from my android phone on Lcd.But when i try it only prints me from 0-9 and other numbers are just symbols.The values should be from 0 to 255.This code controls brightness of leds, and i want to see value on lcd.
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 5, 4, 3, 2);
int Red_LED_Pin = 9; // PWM Pin for Red LED
int Green_LED_Pin = 10; // PWM Pin for Green LED
int Blue_LED_Pin = 11; // PWM Pin for Blue LED
int Juodas_LED_Pin = 6; //
//Varibles to hold brightness values ranging from 0 (off) to 255 (fully on)
int Red_value=0;
int Green_value=0;
int Blue_value=0;
int White_value=0;
char BluetoothData; // the data received from bluetooth serial link
void setup() {
lcd.begin(16, 2);
lcd.print("White:");
// Initialise LED pins as outputs
pinMode(Red_LED_Pin, OUTPUT);
pinMode(Green_LED_Pin, OUTPUT);
pinMode(Blue_LED_Pin, OUTPUT);
pinMode(White_LED_Pin, OUTPUT);
//initialsie serial communication
Serial.begin(9600);
}
void loop() {
//Process any info coming from the bluetooth serial link
if (Serial.available()){
BluetoothData=Serial.read(); //Get next character from bluetooth
if(BluetoothData=='R') Red_value=Serial.parseInt(); //Read Red value
if(BluetoothData=='G') Green_value=Serial.parseInt(); //Read Green Value
if(BluetoothData=='B') Blue_value=Serial.parseInt(); //Read Blue Value
if(BluetoothData=='W') White_value=Serial.parseInt(); //Read White Value
lcd.setCursor(4, 0);
lcd.write(White_value);
}
//update LED Brightness
analogWrite(Red_LED_Pin, Red_value);
analogWrite(Green_LED_Pin, Green_value);
analogWrite(Blue_LED_Pin, Blue_value);
analogWrite(White_LED_Pin, White_value);
delay(10);
}