本帖最后由 pcduino 于 2013-3-14 18:42 编辑
Pcduino越来越给力了,除了能够运行PC操作系统(Ubuntu和Android的ICS等)以及通过内置HDMI接口输出视频到电视或显示器屏幕外,它还可以神奇的运行GPRS Shield,这就意味着你可以使用pcduino打电话了!
#include <core.h>
#include "Serial.h"
#define key1 8
#define key2 9
#define led 10
void port_init()
{
pinMode(key1,INPUT);
pinMode(key2,INPUT);
pinMode(led,OUTPUT);
} void wait()
{
digitalWrite(led,LOW);
delay(200);
digitalWrite(led,HIGH);
delay(200);
}
void setup()
{
//Initialize serial and wait for port to open:
int rate = 19200;
Serial.begin(rate);
while (!Serial)
{
; // wait for serial port to connect. Needed for Leonardo only
}
port_init();
delay(500);
}
void loop()
{
int value1 = digitalRead(key1);
int value2 = digitalRead(key2);
wait();
if(value1)
{
delay(10);
value1 = digitalRead(key1);
if(value1)
{
Serial.println("ATD + +86131xxxxxxxx;");//dial the number
digitalWrite(led,HIGH);
do{
value2 = digitalRead(key2);
if(value2)
{
delay(10);
value2 = digitalRead(key2);
}
}while(!value2);
Serial.println("ATD + ATH");
digitalWrite(led,LOW);
delay(500);
while(1);
}
}
}
|