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:
- 7:aa858d789025
- Parent:
- 6:44ca704f2bc1
- Child:
- 8:5590f55bdf41
--- a/edge_sensor/edge_color.cpp Wed Dec 06 00:35:56 2017 +0000 +++ b/edge_sensor/edge_color.cpp Thu Dec 07 01:06:46 2017 +0000 @@ -100,9 +100,15 @@ print_time(_sampled_time) ; 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%d\",\"PN\":\"VEML6040\",\"VAL_R\":\"%d\",\"VAL_G\":\"%d\",\"VAL_B\":\"%d\",\"UNIT\":\"mW/cm2\",\"S\":\"%06d\",\"E\":\"%d\"}", - _id, _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\":\"%06d\",\"E\":\"%d\"}", + _value[0], _value[1], _value[2],time2seq(_sampled_time), _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) ; + } result = afero->setAttribute(1, _str_buf) ; return( result == afSUCCESS ) ; }