Skip to content

Commit 1f18a9f

Browse files
committed
Setup
0 parents  commit 1f18a9f

File tree

418 files changed

+56450
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

418 files changed

+56450
-0
lines changed

.DS_Store

15 KB
Binary file not shown.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*********************
2+
3+
Example code for the Adafruit RGB Character LCD Shield and Library
4+
5+
This code displays text on the shield, and also reads the buttons on the keypad.
6+
When a button is pressed, the backlight changes color.
7+
8+
**********************/
9+
10+
// include the library code:
11+
#include <Wire.h>
12+
#include <Adafruit_MCP23017.h>
13+
#include <Adafruit_RGBLCDShield.h>
14+
15+
// The shield uses the I2C SCL and SDA pins. On classic Arduinos
16+
// this is Analog 4 and 5 so you can't use those for analogRead() anymore
17+
// However, you can connect other I2C sensors to the I2C bus and share
18+
// the I2C bus.
19+
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
20+
21+
// These #defines make it easy to set the backlight color
22+
#define RED 0x1
23+
#define YELLOW 0x3
24+
#define GREEN 0x2
25+
#define TEAL 0x6
26+
#define BLUE 0x4
27+
#define VIOLET 0x5
28+
#define WHITE 0x7
29+
30+
void setup() {
31+
// Debugging output
32+
Serial.begin(9600);
33+
// set up the LCD's number of columns and rows:
34+
lcd.begin(16, 2);
35+
36+
// Print a message to the LCD. We track how long it takes since
37+
// this library has been optimized a bit and we're proud of it :)
38+
int time = millis();
39+
lcd.print("Hello, world!");
40+
time = millis() - time;
41+
Serial.print("Took "); Serial.print(time); Serial.println(" ms");
42+
lcd.setBacklight(WHITE);
43+
}
44+
45+
uint8_t i=0;
46+
void loop() {
47+
// set the cursor to column 0, line 1
48+
// (note: line 1 is the second row, since counting begins with 0):
49+
lcd.setCursor(0, 1);
50+
// print the number of seconds since reset:
51+
lcd.print(millis()/1000);
52+
53+
uint8_t buttons = lcd.readButtons();
54+
55+
if (buttons) {
56+
lcd.clear();
57+
lcd.setCursor(0,0);
58+
if (buttons & BUTTON_UP) {
59+
lcd.print("UP ");
60+
lcd.setBacklight(RED);
61+
}
62+
if (buttons & BUTTON_DOWN) {
63+
lcd.print("DOWN ");
64+
lcd.setBacklight(YELLOW);
65+
}
66+
if (buttons & BUTTON_LEFT) {
67+
lcd.print("LEFT ");
68+
lcd.setBacklight(GREEN);
69+
}
70+
if (buttons & BUTTON_RIGHT) {
71+
lcd.print("RIGHT ");
72+
lcd.setBacklight(TEAL);
73+
}
74+
if (buttons & BUTTON_SELECT) {
75+
lcd.print("SELECT ");
76+
lcd.setBacklight(VIOLET);
77+
}
78+
}
79+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#include <SPI.h>
2+
#include <Ethernet.h>
3+
#include <Wire.h>
4+
#include <Adafruit_MCP23017.h>
5+
#include <Adafruit_RGBLCDShield.h>
6+
7+
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
8+
9+
#define RED 0x1
10+
#define YELLOW 0x3
11+
#define GREEN 0x2
12+
#define TEAL 0x6
13+
#define BLUE 0x4
14+
#define VIOLET 0x5
15+
#define WHITE 0x7
16+
17+
18+
// Enter a MAC address for your controller below.
19+
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
20+
byte mac[] = {
21+
0x00, 0xAA, 0xBB, 0xCC, 0xCE, 0x02 };
22+
23+
// Initialize the Ethernet client library
24+
// with the IP address and port of the server
25+
// that you want to connect to (port 80 is default for HTTP):
26+
EthernetClient client;
27+
28+
void setup() {
29+
// Open serial communications and wait for port to open:
30+
Serial.begin(57600);
31+
32+
// set up the LCD's number of columns and rows:
33+
lcd.begin(16, 2);
34+
35+
randomSeed(analogRead(0));
36+
}
37+
38+
void loop() {
39+
// set random MaAC
40+
for (byte i = 1; i < 6; ++i) {
41+
mac[i] = random(0,255);
42+
}
43+
44+
Serial.println("DHCP...");
45+
Serial.print("MAC: ");
46+
for (byte i = 0; i < 6; ++i) {
47+
Serial.print(mac[i], HEX);
48+
if (i < 5)
49+
Serial.print(':');
50+
}
51+
Serial.println();
52+
53+
lcd.clear();
54+
lcd.setCursor(0, 0);
55+
lcd.print("DHCP...");
56+
lcd.setCursor(0, 1);
57+
for (byte i = 0; i < 6; ++i) {
58+
lcd.print(mac[i], HEX);
59+
if (i < 5)
60+
lcd.print(':');
61+
}
62+
63+
// start the Ethernet connection:
64+
if (Ethernet.begin(mac) == 0) {
65+
Serial.println("Failed to configure Ethernet using DHCP");
66+
lcd.clear();
67+
lcd.setCursor(0, 0);
68+
lcd.print("DHCP failed");
69+
delay(2500);
70+
} else {
71+
// print your local IP address:
72+
Serial.print("My IP address: ");
73+
lcd.clear();
74+
lcd.setCursor(0, 0);
75+
lcd.print("My IP address: ");
76+
lcd.setCursor(0, 1);
77+
for (byte thisByte = 0; thisByte < 4; thisByte++) {
78+
// print the value of each byte of the IP address:
79+
Serial.print(Ethernet.localIP()[thisByte], DEC);
80+
lcd.print(Ethernet.localIP()[thisByte], DEC);
81+
if (thisByte < 3) {
82+
Serial.print(".");
83+
lcd.print(".");
84+
}
85+
}
86+
Serial.println();
87+
}
88+
delay(5000);
89+
}
90+
91+

BMP085test/BMP085test.ino

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <Wire.h>
2+
#include <BMP085.h>
3+
4+
5+
// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)
6+
// Connect GND to Ground
7+
// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
8+
// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4
9+
// EOC is not used, it signifies an end of conversion
10+
// XCLR is a reset pin, also not used here
11+
12+
BMP085 bmp;
13+
14+
void setup() {
15+
Serial.begin(9600);
16+
bmp.begin();
17+
}
18+
19+
void loop() {
20+
Serial.print("Temperature = ");
21+
Serial.print(bmp.readTemperature());
22+
Serial.println(" *C");
23+
24+
Serial.print("Pressure = ");
25+
Serial.print(bmp.readPressure());
26+
Serial.println(" Pa");
27+
28+
Serial.println();
29+
delay(5000);
30+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
Blink
3+
Turns on an LED on for one second, then off for one second, repeatedly.
4+
5+
This example code is in the public domain.
6+
*/
7+
8+
void setup() {
9+
// initialize the digital pin as an output.
10+
// Pin 13 has an LED connected on most Arduino boards:
11+
pinMode(17, OUTPUT);
12+
}
13+
14+
void loop() {
15+
digitalWrite(17, HIGH); // set the LED on
16+
delay(1000); // wait for a second
17+
digitalWrite(17, LOW); // set the LED off
18+
delay(1000); // wait for a second
19+
}

DHT22_test/DHT22_test.ino

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// FILE: dht_test.pde
3+
// PURPOSE: DHT library test sketch for Arduino
4+
//
5+
6+
#include <dht.h>
7+
8+
dht DHT;
9+
10+
#define DHT11_PIN 5
11+
#define DHT22_PIN 4
12+
13+
void setup()
14+
{
15+
Serial.begin(115200);
16+
Serial.println("DHT TEST PROGRAM ");
17+
Serial.print("LIBRARY VERSION: ");
18+
Serial.println(DHT_LIB_VERSION);
19+
Serial.println();
20+
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
21+
}
22+
23+
void loop()
24+
{
25+
// READ DATA
26+
Serial.print("DHT22, \t");
27+
int chk = DHT.read22(DHT22_PIN);
28+
switch (chk)
29+
{
30+
case 0: Serial.print("OK,\t"); break;
31+
case -1: Serial.print("Checksum error,\t"); break;
32+
case -2: Serial.print("Time out error,\t"); break;
33+
default: Serial.print("Unknown error,\t"); break;
34+
}
35+
// DISPLAT DATA
36+
Serial.print(DHT.humidity, 1);
37+
Serial.print(",\t");
38+
Serial.println(DHT.temperature, 1);
39+
40+
delay(1000);
41+
42+
// READ DATA
43+
Serial.print("DHT11, \t");
44+
chk = DHT.read11(DHT11_PIN);
45+
switch (chk)
46+
{
47+
case 0: Serial.print("OK,\t"); break;
48+
case -1: Serial.print("Checksum error,\t"); break;
49+
case -2: Serial.print("Time out error,\t"); break;
50+
default: Serial.print("Unknown error,\t"); break;
51+
}
52+
// DISPLAT DATA
53+
Serial.print(DHT.humidity,1);
54+
Serial.print(",\t");
55+
Serial.println(DHT.temperature,1);
56+
57+
delay(1000);
58+
}
59+
//
60+
// END OF FILE
61+
//

Jeenode/.DS_Store

12 KB
Binary file not shown.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include <JeeLib.h>
2+
3+
// RF stuff
4+
#define RF_NODEID 6
5+
#define RF_CHANNEL 111
6+
7+
// this must be added since we're using the watchdog for low-power waiting
8+
// ISR(WDT_vect) { Sleepy::watchdogEvent(); }
9+
10+
// number of millisecs to powerdown and sleep for between reading and sending reading
11+
#define DELAY 5000
12+
// receive buffer size
13+
#define BUFFER_SIZE 64
14+
15+
16+
// Payload data structure
17+
typedef struct { //data Structure to be sent, called payload
18+
int node; // sending node ID
19+
float data; // data
20+
} Payload;
21+
Payload data;
22+
23+
24+
25+
void setup() {
26+
rf12_initialize(RF_NODEID, RF12_868MHZ, RF_CHANNEL);
27+
Serial.begin(57600);
28+
Serial.println("Initalising...");
29+
}
30+
31+
32+
void loop() {
33+
if (rf12_recvDone()) {
34+
if (rf12_crc == 0) {
35+
Serial.print(millis()/1000.0);
36+
Serial.print("\t");
37+
Serial.print(rf12_hdr, BIN);
38+
Serial.print("\t");
39+
Serial.print(rf12_len);
40+
Serial.print("\t");
41+
42+
data=*(Payload*) rf12_data;
43+
Serial.print(data.node);
44+
Serial.print("\t");
45+
Serial.print(data.data);
46+
Serial.println();
47+
}
48+
}
49+
}
50+

0 commit comments

Comments
 (0)