I was discussing with Ron about adding a temperature sensor which reads the actual temperature in the sims cockpit. I use a DHT11 temp sensor which also can read humidity and send the temp in Celscius as in Fahrenheit. For use with Airmanager you have to use the "messageport" option, this means adding this library and include it in the Arduino script. Arduino C++ code: -- This function will be called when a message is received from the Arduino. id = hw_message_port_add("ARDUINO_MEGA2560_A", new_message) ------------------------------------- -- Send a message to the Arduino with id 777 and -- This function will be called every 2 seconds In short: I made a timer which now sends every 2 seconds a request with the value of 777 to trigger the Arduino to send the temperature value. Values received in AM console: Shown on EICAS Great idea from Ron I was discussing with Ron about adding a temperature sensor which reads the actual temperature in the sims cockpit. I use a DHT11 temp sensor which also can read humidity and send the temp in Celscius as in Fahrenheit. For use with Airmanager you have to use the "messageport" option, this means adding this library and include it in the Arduino script. Arduino C++ code: -- This function will be called when a message is received from the Arduino. id = hw_message_port_add("ARDUINO_MEGA2560_A", new_message) ------------------------------------- -- Send a message to the Arduino with id 777 and -- This function will be called every 2 seconds In short: I made a timer which now sends every 2 seconds a request with the value of 777 to trigger the Arduino to send the temperature value. Values received in AM console: Shown on EICAS Great idea from Ron Hey Roel, Glad to see that you got this working! Truth be told, the idea of using temp sensors originated with DonnyRay a couple years ago except his idea was to have several temp sensors monitoring the batteries, cockpit temp, cabin temp, the center pedestal and a couple other places that monitor temperatures. I personally didn't think it was necessary to have temp sensors in places where we would not be able to replicate temperatures that replicate batteries overheating as an example. We could model batteries getting warm or overheating in software much easier than modeling a real heat source to replicate batteries overheating that are not actually there. But in the case of the Cabin Temp, this is a real thing that we can detect as we are in the cockpit. It beats the static display that never changes! Great work Roel! By the way, I know I have said this a dozen times, but every time I see a bunch of code like what you have posted above, it's mind boggling to me how you guys can read, understand and make it work. Hey Roel, Glad to see that you got this working! Truth be told, the idea of using temp sensors originated with DonnyRay a couple years ago except his idea was to have several temp sensors monitoring the batteries, cockpit temp, cabin temp, the center pedestal and a couple other places that monitor temperatures. I personally didn't think it was necessary to have temp sensors in places where we would not be able to replicate temperatures that replicate batteries overheating as an example. We could model batteries getting warm or overheating in software much easier than modeling a real heat source to replicate batteries overheating that are not actually there. But in the case of the Cabin Temp, this is a real thing that we can detect as we are in the cockpit. It beats the static display that never changes! Great work Roel! By the way, I know I have said this a dozen times, but every time I see a bunch of code like what you have posted above, it's mind boggling to me how you guys can read, understand and make it work.Temperature sensor
Since i use the Airmanager software i said this must be possible.
Well after some struggling it IS!
Using DHT11 | Arduino Project Hub
The Arduino then takes over the control of this sensor and send as requested by AM the temp.
function new_message(id, payload)
-- Do something with the message from the Arduino
print("message received: "..id.." "..payload)
Temp_read = math.floor(payload)
print(Temp_read)
txt_set(txt_TAT, Temp_read)
end
function messageport_timer_callback(count)
flipflop= not flipflop --switches the value with every call
if flipflop == true then
hw_message_port_send(id, 777, "STRING", "TEMP")
end
end
timer_start(0, 2000, messageport_timer_callback)
This value is put in a AM variable to show on the EICAS display
i only have to implement it in the Sim.
Since i use the Airmanager software i said this must be possible.
Well after some struggling it IS!
Using DHT11 | Arduino Project Hub
The Arduino then takes over the control of this sensor and send as requested by AM the temp.
function new_message(id, payload)
-- Do something with the message from the Arduino
print("message received: "..id.." "..payload)
Temp_read = math.floor(payload)
print(Temp_read)
txt_set(txt_TAT, Temp_read)
end
function messageport_timer_callback(count)
flipflop= not flipflop --switches the value with every call
if flipflop == true then
hw_message_port_send(id, 777, "STRING", "TEMP")
end
end
timer_start(0, 2000, messageport_timer_callback)
This value is put in a AM variable to show on the EICAS display
i only have to implement it in the Sim.
2017-10-10