From the previous reviews, we found that pcDuino3 can meet the normal needs as a mini PC. Moreover, pcDuino3 has the hardware headers compatible with Arudino Uno. Keep in mind that there is NO AVR chip on pcDuino3. All the Arduino programming is simulated by the low level API developed by pcDuino team. Most Arduino shields can be used on pcDunio3. There is a built-in special version of Arduino IDE on pcDuino3 that can be used to develop the projects.
Hardware Interface Tests:
ADC of pcDuinoV3:
We use the ADC port to read the analog voltage of the Linker temperature sensor, and convert it into a human readable reading. As shown below, we connect the Linker temperature sensor to pcDuino3 through a linker base shield.
Software wise, we launch Arduino IDE that comes with pcDuino3, navigate through File -> Examples -> 00.pcDuino -> 02.linker_kits -> linker_temperature_sensor_test , open the code, and run the program. The Celsius and Fahrenheit readings will be displayed on the terminal:
UART of pcDuinoV3:
We connect the serial port of pcDuino3 to a computer via a UART to USB breakout board:
Copy and paste the following code to the Arduino IDE:
#include <core.h>
void setup() {
// put your setup code here, to run once:
Serial.begin (9600);
}
void loop() {
// put your main code here, to run repeatedly:
while (Serial.available () > 0){
char c = Serial.read ();
Serial.print (c);
printf ("%c",c);
fflush (stdout);
}
}
Run the program:
Windows 1, 2 and 3 are Arduino IDE on pcDuino3, running terminal window on pcDuino3 and serial terminal on host computer respectively. By looking at windows 2 and 3, we find that when we enter “hello LinkSprite!!!” in terminal 2, pcDuino received the message , and sent to the PC, and PC displayed the message on window 3.
PWM of pcDuinoV3:
Connect a Linker LED module to the PWM port of pcDuino through the Linker base shield, and using the PWM sample code, we can obtain a breathing LED.
The LED will slowly change from dark the bright, and change from bright to dark slowly, and then repeat the process.
SPI of pcDuinoV3:
We use the LED matrix to test the SPI port. LED matrix kit is a 8×8 LED matrix, its diver chip is MAX7219. MAX7219 communicate via the SPI interface and the host. We can use the pcDuino 3 SPI interface API to use it. Connect the LED matrix to the pcDuino3. Then copy and paste the following code to the Arduino IDE of pcDuino3, you can download the corresponding code from
http://cnlearn.linksprite.com/wp-content/uploads/2013/10/led_matrix_kit.c
When running the program, the LED matrix will display 0-9, A-Z and Chinese characters repeatedly.
IIC of pcDuino3:To test IIC, we can use a Linker RTC module, which has a chipset of DS1307. DS1307 communicates with the host through an IIC interface.
Launch the Arduino IDE that comes with pcDuino3, and navigate through File -> Examples -> 00.pcDuino -> 02.linker_kits -> linker_rtc_test :
Compile and run the program, enter the corresponding parameters in the terminal, and then the RTC module will start to time:
Interrupt of pcDuino3:
pcDuino3 is same as Arduino Uno in that the function attachInterrrupt can only use interrupts 0 and 1, which correspond to D2 and D3.
In this test, we apply a low level signal to D2, so pcDuino3 will generate an interrupt to turn on the LED that is attached to pin 4. The code is as below:
#include <core.h>
#define MAX_COUNT 30
#define INT_MODE FALLING
/* support two interrupts pin2/pin3, and default interrupt pins are pulled up*/
int led_pin0 = 5;
volatile int state0 = LOW;
int bc0 = 0;
void blink0()
{
state0 = !state0;
bc0++;
printf("blink0: %d, count=%drn", state0, bc0);
}
void setup()
{
pinMode(led_pin0, OUTPUT);
attachInterrupt(0, blink0, INT_MODE);
}
void loop()
{
digitalWrite(led_pin0, state0);
if (bc0 >= MAX_COUNT)
detachInterrupt(0);
delay(1000);
}
The setup is as below. The LED is not on at first:
Once we apply a low level signal (through ground) to D2 of pcDuino3, the LED will turn on.
The terminal will print the number of blinks and the state. .
When it counts to 30, the interrupt will disappear, give the low level for the D2 port, the state won’t change.
Leave a Reply
You must be logged in to post a comment.