Orefatoi
/
afero_poc15_171201
POC1.5 prototype 2 x color sensor 2 x LM75B 3 x AnalogIn 1 x accel
Diff: edge_sensor/edge_color.cpp
- Revision:
- 8:5590f55bdf41
- Parent:
- 7:aa858d789025
- Child:
- 9:f958fa2cdc74
--- a/edge_sensor/edge_color.cpp Thu Dec 07 01:06:46 2017 +0000 +++ b/edge_sensor/edge_color.cpp Thu Dec 07 10:13:13 2017 +0000 @@ -97,17 +97,19 @@ int edge_color::deliver(void) { int result ; + char timestr[16] ; print_time(_sampled_time) ; + time2seq(_sampled_time, timestr) ; printf(" color %d : R = %4d, G = %4d, B = %4d\n", _id, _value[0], _value[1], _value[2]) ; if (_id == 1) { /* color1 */ sprintf(_str_buf, - "{\"DEVICE\":\"COLOR\",\"PN\":\"VEML6040\",\"VAL_R\":\"%d\",\"VAL_G\":\"%d\",\"VAL_B\":\"%d\",\"UNIT\":\"mW/cm2\",\"S\":\"%06d\",\"E\":\"%d\"}", - _value[0], _value[1], _value[2],time2seq(_sampled_time), _error_count) ; + "{\"DEVICE\":\"COLOR\",\"PN\":\"VEML6040\",\"VAL_R\":\"%d\",\"VAL_G\":\"%d\",\"VAL_B\":\"%d\",\"UNIT\":\"mW/cm2\",\"S\":\"%s\",\"E\":\"%d\"}", + _value[0], _value[1], _value[2], timestr, _error_count) ; } else { /* color2 */ sprintf(_str_buf, - "{\"DEVICE\":\"COLOR02\",\"PN\":\"VEML6040\",\"VAL_R\":\"%d\",\"VAL_G\":\"%d\",\"VAL_B\":\"%d\",\"UNIT\":\"mW/cm2\",\"S\":\"%06d\",\"E\":\"%d\"}", - _value[0], _value[1], _value[2],time2seq(_sampled_time), _error_count) ; + "{\"DEVICE\":\"COLOR02\",\"PN\":\"VEML6040\",\"VAL_R\":\"%d\",\"VAL_G\":\"%d\",\"VAL_B\":\"%d\",\"UNIT\":\"mW/cm2\",\"S\":\"%s\",\"E\":\"%d\"}", + _value[0], _value[1], _value[2], timestr, _error_count) ; } result = afero->setAttribute(1, _str_buf) ; return( result == afSUCCESS ) ;