Ketai sensor onTemperatureEvent

Why is Temp: 0.0?

import ketai.sensors.*;

KetaiSensor sensor;
float temp;

void setup()
{
  fullScreen();
  sensor = new KetaiSensor(this);
  sensor.start();
  sensor.list();
  orientation(LANDSCAPE);
  textAlign(CENTER);
  textSize(displayDensity * 28);
}

void draw(){
  background(78, 93, 75);
  text("Temp: " + temp, width/2, height/2);
}
void onTemperatureEvent(float tempe){
  temp = tempe;
}
1 Like

@noel can you please Help me?

Unfortunately Noel left. Hasnt been seen for over a month.

oh I’m sorry :worried:

Can you Help me with the onTemperatureEvent ?*

what help do you want ?

I want my battery temperature to be displayed as text but don’t know how to do it

which mobile os do you use ?
Android or iOS ?

I have a Android Phone

@Rogo === what return sensorList??? - is Temperature listed?

I dont know wait i show

Nope its not in the list

@Rogo === if no, you cant get the temp!

how can i do it :worried:

Uhm hello? :worried:

@Rogo === a lot of devices are without this sensor which is a physical one; so you have to ask wether it s available; if not change your phone add it this sensor…Another solution (which is a workaround!) coul be to get the temp from your geoloc through the web.

fullScreen();
  sensor = new KetaiSensor(this);
  
  sensor.start();
  println("temp===="+sensor.isTemperatureAvailable());

@Rogo === excuse me, i have posted too quicly= if you want only to get the battery temp that is possible through android batteryManager but not with Ketai.https://developer.android.com/reference/android/os/BatteryManager

temp====false
temp====false
temp====false
temp====false
temp====false
temp====false
temp====false
temp====false

it just comes

@Rogo === that means that your phone has no (physical) sensor for ambient temperature, as it is possible for only few devices; but as i have written if you want only temperature for battery you can probably get it with batteryManager. Of course Ketai lib is absolutely useless for that. If necessary i can put code for that.

1 Like

you can it may be possible that you phone doesnot have a temperature sensor in it !

I am not sure if ketai support battery temp since I used ketai long time ago !

You can see how to get battery temperature in android programatically Stackoverflow/hget-battery-temperature-in-android