Display Ez-b V4 Info On Lcd Display

 
#1

Any ideas in how can I display my v4's CPU temp and battery voltage on an LCD05 16x2 display? I looked for possible variables to do something like the following but couldn't find any...

Code:

#NOTE: Non working code's for example
#purposes only

i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255,"CPU temp is " + $CPUtemp)

#or

i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255,"Battery voltage is " + $BatteryVoltage)



Any ideas guys as I'm not sure what to do next to create a variable to be read and displayed on the LCD?

Thanks.

#2

There are script commands for this (from the script manual):

Code:


GetCPUTemp()
Returns the CPU Temperature of the EZ-B v4
Example: $x = GetCPUTemp()

GetVoltage()
Returns the EZ-B v4 Battery Voltage
Example: $x = GetVoltage()



Alan

#3

Thanks for the reply Alan.

Lol, yep, completely overlooked that. Thanks for that Alan. Very much appreciated Smile.

For anyone else who may be looking do do this, make a script with the following...

Code:

#This example is for an LCD05 16x2
#display.

#Initiate variable
$CPUtemp = getCPUTtemp()
sleep(100)
#Displays current information
i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255,"The CPU temperature is " + $CPUtemp)



This script could be in a script manager and the CPU temp at that point will be displayed when it is run. (See next post for advice on automatically updating the temp).

Steve.

#4

If you only put that in the init, you will only ever have the value on startup. You'l either need a loop or a waitforchange to keep it updated.

Alan

#5

@Alan.

Good point. Although I kinda meant put the "Init" in a connection script, and run the display temp script when desired, but I see what you mean now. I've edited the post above to make that a bit clearer. Thanks again buddy. The way I'm using it is to scroll through different information (time, date, voltage, CPU ect) every few seconds.

Code:

#This example is for an LCD05 16x2
#display.

:loop
$cpu = getcputemp()
$voltage = getvoltage()
sleep(100)
i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255,"Date: " + $date)
sleep(4000)
i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255,"v4 battery is at " + $voltage, " Volts")
sleep(4000)
i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255," CPU temp is at " + $cpu, " Celsius")
sleep(4000)
i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255," Time is " + $time)
sleep(4000)
GoTo(loop)



One quick question, on the message script, what do I need to add to get it to display "Celsius" or "Volts" after the variable so it displays, for example, "v4 battery is at 7.2 volts"? At the moment, it's just displaying the 7.2.

#6

Not to worry. I figured it out. Winky

Code:

i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255,"v4 battery is at " + $voltage," Volts.")

#7

@Steve, do you have a link on where to buy/more information on the "LCD005" display?

#8

@69developer.

I sure do. The website has technical data for these displays as well.

LCD05 displays

Technical documentation

#9

I use;

Code:

i2cwrite(0,0xc6,0,1,4,12,19,30,230,31,255,"v4 battery is at " + GetVoltage() + " Volts.")



Loop that with a 1000ms sleep or flip flop between voltage and temp. Melvin cycled through voltage, temperatures, time and date changing every 5000ms which looked fine, worked well and kept the demand down.