United Kingdom
Asked — Edited

Display Ez-B V4 Info On Lcd Display

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...

#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.


ARC Pro

Upgrade to ARC Pro

Your robot can be more than a simple automated machine with the power of ARC Pro!

#1  

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


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

United Kingdom
#2  

Thanks for the reply Alan.

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

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

#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.

#3  

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

United Kingdom
#4  

@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.

#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.

United Kingdom
#5  

Not to worry. I figured it out.;)

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

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

United Kingdom
#8  

I use;

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.