Sensorian  1.0
C API Reference Guide Library
main.c
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (C) 2015 Sensorian
3  * *
4  * This file is part of Sensorian. *
5  * *
6  * Sensorian is free software: you can redistribute it and/or modify it *
7  * under the terms of the GNU Lesser General Public License as published *
8  * by the Free Software Foundation, either version 3 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * Sensorian is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with Sensorian. *
18  * If not, see <http://www.gnu.org/licenses/>. *
19  ****************************************************************************/
20 
29 #include <bcm2835.h>
30 #include <stdio.h>
31 #include "Utilities.h"
32 
33 int main(int argc, char **argv)
34 {
35  if (!bcm2835_init()) //Configure I2C pins
36  {
37  printf("BCM libray error.\n");
38  }
39 
40  printf("LED blinking demo with the Sensorian Shield.\r\n");
41 
43 
44  while (1)
45  {
46  for(int j=0;j<100;j++)
47  {
48  for(int k=0;k<128;k++)
49  {
50  for(int i=0;i<100;i++)
51  {
52  if(i<j)
53  {
54  digitalWrite(LED_PIN, HIGH);
55  }else{
56  digitalWrite(LED_PIN, LOW);
57  }
58  }
59  }
60  }
61 
62  for(int j=0;j<100;j++)
63  {
64  for(int k=0;k<128;k++)
65  {
66  for(int i=100;i>0;i--)
67  {
68  if(i>j){
69  digitalWrite(LED_PIN, HIGH);
70  }else {
71  digitalWrite(LED_PIN, LOW);
72  }
73 
74  }
75  }
76  }
77 
78 
79  }
80 
81  bcm2835_close();
82  return 0;
83 }
84 
void pinModeOutput(PIN_t pin)
Configures the given pin as output.
Definition: Utilities.c:49
Utilities driver header.
int main(int argc, char **argv)
Definition: main.c:34
void digitalWrite(PIN_t pin, unsigned char level)
Write a logic level to the pin. The pin should be confgured as output.
Definition: Utilities.c:60
#define LED_PIN
Definition: Utilities.h:46