Извините, но я снова про немцев. Оказывается, Dr. Ing. Michael Schoeffler на гитхабе пишет про себя так:
I’m a research engineer working in the field of Industrial IoT.
Парочка примеров кода от инженера-исследователя, работающего в индустриальном IoT:
void loop() {
if (Serial.available() > 0) {
byte incomingByte = 0;
incomingByte = Serial.read(); // read the incoming byte:
if (incomingByte != -1) { // -1 means no data is available
lcd.setCursor(0, 0); // set cursor to first row
lcd.print("I received: "); // print out to LCD
lcd.setCursor(0, 1); // set cursor to secon row
lcd.print(incomingByte); // print out the retrieved value to the second row
}
}
}
О существовании буквы «я», конечно, в индустриальном IoT можно не задумываться.
long hexstr_to_value(char *str, unsigned int length) { // converts a hexadecimal value (encoded as ASCII string) to a numeric value
char* copy = malloc((sizeof(char) * length) + 1);
memcpy(copy, str, sizeof(char) * length);
copy[length] = '\0';
// the variable "copy" is a copy of the parameter "str". "copy" has an additional '\0' element to make sure that "str" is null-terminated.
long value = strtol(copy, NULL, 16); // strtol converts a null-terminated string to a long value
free(copy); // clean up
return value;
}
malloc() на микроконтроллере — это, несомненно, очень индустриально.
accelerometer_x = Wire.read()<<8 | Wire.read(); // reading registers: 0x3B (ACCEL_XOUT_H) and 0x3C (ACCEL_XOUT_L)
Я бы еще вписал где-нибудь в этой программе i++ + ++i
.
А вы говорите Bosch, настоящее немецкое качество и все такое.