Code Maintenance & Programming Rules

 This guide outlines essential best practices spanning code style, architectural design, debugging, testing, performance, and portability—all aimed at reducing the long-term cognitive load of code maintenance. 🎨 1. Style Code is written for humans to read, and only incidentally for computers to execute. Variable Naming : Use descriptive names for global variables, and short names for local variables. Precision and Consistency : Use active names for functions (e.g., calculateTotal ). Above all, keep your coding style consistent throughout the project. Structure & Expressions : Use a consistent indentation and brace ( {} ) style to show program structure visually. Use the natural form for expressions. Use parentheses to make the semantics unambiguous. Break up overly complex expressions to keep them clear. Side Effects & Macros : Beware of functions with side effects. Avoid function-like macros; if unavoidable, parenthesize the macro body and arguments carefully. Magic Numbe...

在 S4A 軟體上玩 Arduino Esplora

用了四個Scratch for Arduino軟體做初步的使用,結果如下:

mBlock
可與控制 RGB LED的三種顏色、Buzzer、Pin 13的 LED、Buzzer

S4A
可與控制 RGB LED的紅色與藍色兩種顏色、Buzzer、Pin 13的 LED、Buzzer

WFduino
連線不成功

Transformer-community
無法更新 Esplora 的韌體

以上軟體全部無法讀取到 Esplora 上的感測器,原因在於 Esplora 在Sensor電路設計時,利用多工器(型號為74HC4067DB)來處理的,並且將 analog pin A0 ~ A3當成數位輸入,這點從 Esplora 的程式碼可看出端倪。



而這四個S4A的軟體皆無法將Analog腳位設為數位腳位來使用,需用別的方式來使用,做 extension與修改Firmdata的韌體才有可能做到吧。

若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。

留言

這個網誌中的熱門文章