Arduino电子排队叫号机
这是为谋诊所设计的排队叫号机,计数器只需显示两位数。此叫号机使用了两片Arduino,一个安置在房内用来输入编号,称之为发送器,另一个则安装在房外,用来显示编号,称之为接收器。发送器是通过串口发送信息给接收器。
发送器连接了一个PS2键盘来完成输入,当然也可以使用USB键盘,不过必须添加一个USB Host Shield,这样将会增加成本。如果没办法取得PS2键盘,建议使用矩阵键盘。发送器也应用了一个小型LCD,用于显示编号,当然还能显示更多的相关资料。
接收器用了一片32x16像素的矩阵LED单元板,用来显示从串口取得的相关数据。接收器也安装了一个“铃铛”报知器,每当接收到来自发送器的数据,都会温馨提醒一下。
Using HEF4094 Shift Registers with Arduino
I have many seven segment modules in my hand. Each module consists of 5 digits and each digit is controlling by individual HEF4094 shift register. As shown in figure above is the seven segment module.
HEF4094 is an 8-stage serial shift register. Data is shifted on the LOW-to-HIGH transitions of the CP (Clock) input. The product data sheet is available here.
HEF4094 operates over a recommended VDD power supply range of 3 V to 15 V referenced to VSS (usually ground). There is also 74HC4094 available which operates at 2V to 6V.
Arduino based RGB Matrix LED tester

This is a very simple Arduino project which control the 16x32 RGB LED Matrix Panel via an 16pin IDC cable. The Arduino will continuously sending 5 set colours (Red, Green, Blue, White, Black) to the LED Matrix Panel that allow the technician to find out which part of the LED Matrix Panel is malfunction.
Wireless Router Remote Control Car

This is my first RC car control by an Arduino and a wirless router running OpenWRT. There are many OpenWRT supported routers, I'm using a TP-Link TL-MR3020 3G/4G Wireless N Router for this project since it is very slim, low power consumption and it is cheap.
RC car features
- A webcam, the car can be driven without line of sight
- A horn so that you can honk at people.
- LED Headlights attached to the front of the car
- Two wheel drive motor
- Windows GUI application or web interface
- Future Additions: Control by a smartphone (Android & IOS)
Count number of digits in a number and extract each digit
byte countDigits(int num){ byte count=0; while(num){ num=num/10; count++; } return count; }
int getDigit(unsigned int number, int digit) { for (int i=0; i<digit-1; i++) { number /= 10; } return number % 10; }
#define MAX_NUMBER_OF_DIGITS 5 byte array_to_hold_digit[MAX_NUMBER_OF_DIGITS]; void setup(void) { Serial.begin(9600); extractDigit_Save2Arrary(5678); Serial.println(array_to_hold_digit[0]); Serial.println(array_to_hold_digit[1]); Serial.println(array_to_hold_digit[2]); Serial.println(array_to_hold_digit[3]); } void loop(void) { } /*---------------------------------------------------------------------------- count number of digits in a number(integer) ----------------------------------------------------------------------------*/ void extractDigit_Save2Arrary(int number){ byte number_of_digit = countDigits(number); for (byte i=0; i<number_of_digit; i++) { array_to_hold_digit[i] = getDigit(number,number_of_digit-i); //store each digit to array } /* for (byte i=0; i<number_of_digit; i++) { Serial.print(array_to_hold_digit[i]); } Serial.println(); */ } /*---------------------------------------------------------------------------- count number of digits in a number(integer) ----------------------------------------------------------------------------*/ byte countDigits(int number){ byte count=0; while(number){ number=number/10; count++; } return count; } /*---------------------------------------------------------------------------- extract a digit from an number(integer) ----------------------------------------------------------------------------*/ byte getDigit(unsigned int number, int digit) { for (int i=0; i<digit-1; i++) { number /= 10; } return number % 10; }
Debouncing Multiple Switches

- You are unlikely to enable the internal pull-up resistor on switch pins, therefore each switch require an external pull-up resistor
- It is not possible to detect the switch state before main loop (setup). When you press a switch during power on, you will never get the state of the switch.
Arduino function with optional argument(s)
functionReturnType myFunctionName(optionalArgumentType optionalArgument = defaultValue); |
functionReturnType myFunctionName(optionalArgumentType optionalArgument); |
myFunctionName(); // Use the default value |
int myFunction(int optionalArgument = 1); void setup() { Serial.begin(9600); } void loop() { Serial.println(myFunction()); // Use the default value Serial.println(myFunction(2)); // Use specific value } int myFunction(int optionalArgument) { return optionalArgument; }
Arduino running at 8MHz internal clock with Optiboot bootloader
############################################################## |
############################################################## |
Using an Arduino board to burn the bootloader
If your ATMega8/ATmega328 already configured to use external clock, then wire up the Arduino board & microcontroller as show in figure 1, otherwise (microcontroller configured to use internal clock) you can follow either figure 1 or figure 2.
- Upload the ArduinoISP sketch onto your Arduino board.
- From Tools>Board menu, select ATmega328 Optiboot (8MHz internal clock) if you want to burn the bootloader on ATMega328 microcontroller
- From Tools>Board menu, select ATmega8 Optiboot (8MHz internal clock) if you want to burn the bootloader on ATMega8 microcontroller
- From Tools>Programmer> menu, select Arduino as ISP
- Select Burn Bootloader from Tools menu to start burning bootloader to microcontroller
Sharp GP2Y0A21红外线测距传感器

- 距离测量范围:10至80cm(4“到32”)
- 工作电压:4.5V至5.5V
- 输出类型:模拟电压
- 平均功耗:35mA
- 峰值功耗:约200mA
- 允许的最大角度:> 40°
- 更新频率/周期:25 Hz/40毫秒
Sharp GP2Y0A21 IR distance sensors
Sharp GP2Y0A21 is an infra-red distance measuring sensor unit, it is extremely effective, easy to use, very affordable and has low power consumption. specification as follow:
- Distance measuring range: 10 to 80cm (4" to 32")
- Operating voltage: 4.5V to 5.5V
- Output type: Analog voltage
- Average power consumption : 35 mA
- Peak power consumption : about 200 mA
- Output voltage differential over distance range: 1.9V
- Maximum allowable Angle : > 40 °
- The frequency of updates/cycle : 25 Hz/40 ms