Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <Ethernet.h>
- #include <MFRC522.h>
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- #include <Keypad.h>
- LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
- /******************** ETHERNET SETTINGS ********************/
- /* W500 Module */
- byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x85, 0xD9 }; //physical mac address
- byte ip[] = { 192, 168, 0, 223 }; // ip in lan
- byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
- byte gateway[] = { 192, 168, 0, 1 }; // default gateway
- byte server[] = { 192, 168, 0, 10};
- EthernetClient client;
- void setup()
- {
- Serial.begin(9600);
- Serial.println("Starting up");
- lcd.begin(20, 4);
- Ethernet.begin(mac, ip, gateway, subnet); // initialize Ethernet device
- }
- void loop() {
- String postData = "card=1&function=2";
- if (client.connect("192.168.0.10", 80)) {
- Serial.println("Connected to server");
- // Make a HTTP request
- String content = "Hey, just testing a post request.";
- client.println("POST /tat/arduino/add_data.php HTTP/1.1");
- client.println("Host: 192.168.0.10:80");
- client.println("User-Agent: Arduino/1.0");
- client.println("Content-Type: application/x-www-form-urlencoded");
- client.print("Content-Length: ");
- client.print(postData.length());
- client.println("Accept: */*");
- client.println();
- client.println(content);
- } else {
- Serial.println("Connect failed");
- }
- delay(1500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement