/******************************************************************
* Copyright (C) 2009 Ram Narula
* Filename: main.cpp
* Version: 0.1
* Date: 14 July 2009
* Information: http://www.xduino.com/
******************************************************************/
/******************************************************************
* This file is part of Xduino
*
* Xduino is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Xduino is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Xduino. If not, see .
******************************************************************/
/* General Xduino include files */
#include "generalInit.h"
#include "doGPIO.h"
#include "Serial.h"
#include "generalUtil.h"
#define INPUT GPIO_Mode_IN_FLOATING
#define OUTPUT GPIO_Mode_Out_PP
int main(void)
{
doInit(); //Initialize
doGPIO Led1 = doGPIO(GPIOB,GPIO_Pin_7,OUTPUT); //using PB7
Serial Computer1 = Serial(1,115200); //USART1
Computer1.println("Starting Xduino example...");
Led1.High();
delay(2000);
Led1.Low();
delay(3000);
for(int i=0;i<=10;i++)
{
Led1.Toggle();
delay(200);
}
if(Led1.Read())
{
Computer1.println("On");
} else {
Computer1.println("Off");
}
while(1)
{
if(Computer1.available())
{
Computer1.print("Character "); //print string
Computer1.printchar(Computer1.read()); //print single character
Computer1.println("..."); //print string with new line
}
}
}