jardazov
Vytvořené odpovědi
-
AutorPříspěvky
-
kristian
Účastník
kristian
Účastník#include <EEPROM.h> #include <OneWire.h> #include <DallasTemperature.h> #include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_TFTLCD.h> // Hardware-specific library //#include <stdint.h> #include "TouchScreen.h" #define LCD_CS A3 // #define LCD_CD A2 // #define LCD_WR A1 // #define LCD_RD A0 // #define LCD_RESET A4 // #define YP A1 // must be an analog pin, use "An" notation! #define XM A2 // must be an analog pin, use "An" notation! #define YM 7 // can be a digital pin #define XP 6 // can be a digital pin // definice max a min tlaku na TouchScreen #define MINPRESSURE 10 #define MAXPRESSURE 1000 #define TS_MINX 131 #define TS_MINY 947 #define TS_MAXX 901 #define TS_MAXY 129 #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define CYAN 0x07FF #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300); // inicializace TouchScreen Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); // inicializace LCD double cislo=1; int x, y = 0; TSPoint p; int NASTAVENAteplota; // Data wire is plugged into port 2 on the Arduino #define ONE_WIRE_BUS SCL // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); // arrays to hold device address DeviceAddress insideThermometer; void setup(void) { NASTAVENAteplota= EEPROM.read(0); pinMode(13, OUTPUT); digitalWrite(13, HIGH); // 0=off tft.reset(); tft.begin(0x9341); // inicializace naseho LCD shieldu tft.fillScreen(WHITE); sensors.begin(); if (!sensors.getAddress(insideThermometer, 0)) //tft.println("Unable to find address for Device 0"); delay(2); sensors.setResolution(insideThermometer, 9); tft.fillScreen(WHITE); } float temp=0; void printTemperature(DeviceAddress deviceAddress) { float tempC = sensors.getTempC(deviceAddress); if (tempC!=temp) { temp=tempC; tft.fillScreen(WHITE); tft.print(temp); } } void loop(void) { //digitalWrite(13, HIGH); TSPoint p = ts.getPoint(); //digitalWrite(13, LOW); pinMode(XM, OUTPUT); pinMode(YP, OUTPUT); if (p.z > MINPRESSURE && p.z < MAXPRESSURE) { p.x = tft.width()-(map(p.x, TS_MINX, TS_MAXX, tft.width(), 0)); p.y = tft.height()-(map(p.y, TS_MINY, TS_MAXY, tft.height(), 0)); if((75<p.x)&&(p.x<220)&&(57<p.y)&&(p.y<170)) { int menu=3; tft.fillScreen(RED); delay(500); tft.fillScreen(WHITE); //////////////////////////////////////////////////////// tft.setRotation(1); tft.drawFastHLine(0,39,320,RED); tft.drawFastHLine(0,40,320,RED); tft.drawFastHLine(0,41,320,GREEN); tft.drawFastHLine(0,42,320,GREEN); tft.drawFastHLine(0,43,320,BLUE); tft.drawFastHLine(0,44,320,BLUE); tft.setTextColor(RED); tft.setCursor(200,12); tft.setTextSize(2); tft.setRotation(1); tft.print("KikoSonic"); tft.setCursor(5,5); tft.setTextSize(4); tft.setRotation(1); tft.print("Menu"); tft.setCursor(62,168); tft.setTextColor(BLACK); tft.setTextSize(5); tft.setRotation(1); tft.print("-"); tft.drawRoundRect(40,150,70,70,10,BLACK); //spodny lavy tft.setCursor(184,174); tft.setTextColor(BLACK); tft.setTextSize(4); tft.setRotation(1); tft.print("End"); tft.drawRoundRect(150,150,140,70,10,BLACK); //spodny pravy tft.setCursor(62,78); tft.setTextColor(BLACK); tft.setTextSize(5); tft.setRotation(1); tft.print("+"); tft.drawRoundRect(40,60,70,70,10,BLACK); // vrch.lavy tft.setCursor(184,90); tft.setTextColor(BLACK); tft.setTextSize(4); tft.setRotation(1); tft.print(NASTAVENAteplota); while (menu==3){ TSPoint p = ts.getPoint(); pinMode(XM, OUTPUT); pinMode(YP, OUTPUT); if (p.z > MINPRESSURE && p.z < MAXPRESSURE) { p.x = tft.width()-(map(p.x, TS_MINX, TS_MAXX, tft.width(), 0)); p.y = tft.height()-(map(p.y, TS_MINY, TS_MAXY, tft.height(), 0)); if((140<p.x)&&(p.x<231)&&(30<p.y)&&(p.y<83)) //+ { tft.setCursor(184,90); tft.setTextColor(WHITE); tft.setTextSize(4); tft.setRotation(1); tft.print(NASTAVENAteplota); NASTAVENAteplota++; if (NASTAVENAteplota==100) { NASTAVENAteplota=99; } tft.setCursor(184,90); tft.setTextColor(BLACK); tft.setTextSize(4); tft.setRotation(1); tft.print(NASTAVENAteplota); delay(200); } if((15<p.x)&&(p.x<105)&&(30<p.y)&&(p.y<83)) //- { tft.setCursor(184,90); tft.setTextColor(WHITE); tft.setTextSize(4); tft.setRotation(1); tft.print(NASTAVENAteplota); NASTAVENAteplota--; if (NASTAVENAteplota==0) { NASTAVENAteplota=1; } tft.setCursor(184,90); tft.setTextColor(BLACK); tft.setTextSize(4); tft.setRotation(1); tft.print(NASTAVENAteplota); delay(200); } if((15<p.x)&&(p.x<105)&&(111<p.y)&&(p.y<217)) //end { menu=0; EEPROM.write(0, NASTAVENAteplota ); } } } } temp=0; tft.fillScreen(RED); delay(1000); tft.fillScreen(WHITE); } //---------------------------menu---------------------- tft.setCursor(45, 80); tft.setTextColor(BLACK); tft.setTextSize(7); tft.setRotation(1); sensors.requestTemperatures(); // Send the command to get temperatures if (temp>=NASTAVENAteplota) //digitalWrite(13, LOW); //0=on digitalWrite(13, HIGH);//opacna logika //else // digitalWrite(13, HIGH); // 1=off if (temp<NASTAVENAteplota-0.5) digitalWrite(13, LOW);//opacna logikaopacna logika printTemperature(insideThermometer); } // function to print a device address void printAddress(DeviceAddress deviceAddress) { for (uint8_t i = 0; i < 8; i++) { if (deviceAddress[i] < 16) Serial.print("0"); tft.print(deviceAddress[i], HEX); } }
marh
Účastníkarduino nano+DS18B20+enc28j60
enc28j60 CS pin je na arduine 8
senzory sa daju upraviť ine ale ak vyhodnotenie merania je ine tak treba len upraviť kod na zistenie hodnoty na senzorepozri tu, teraz nie je napojene meranie , je to len stara historia
https://thingspeak.com/channels/38430arduino 2x 1-wire bus 4x ds18b20 thingspeak
4sensory 2x na pine 6 a 2x pine 7 —môžete dať všetky štyri na jeden Pin a zmeniť kod
dal som na 2 piny kvôli parazitnym väzbam na dlhom kabli, lebo nemeralo vždy
arduino načita teploty z Pinu 6/7
samozrejme treba upraviť kod:
pridať adresy čisiel, môžete si zmeniť nazvy a zadať kľuč pre THINGSPEAK/* | | arduino nano, 4x sensor ds18b20 on PIN6/PIN7 , used is 2x 1-wire bus | arduino program 1.6.4 | Post 4 temperatures from a DS18B20 to ThingSpeak using the Ethercard interface based on the | ENC28J60 chip. ethercard <EtherCard.h> from master | Based on the Ethercard example from www.jeelabs.org | enc28j60 CS is pin 8 | library ethercard from master , ethercardmaster.zip | Phil Grant Jan 2014 */ #include <EtherCard.h> // change these settings to match your own setup #define APIKEY "C06FVBVE5DCU0UK1 " // plug your API KEY #include <Wire.h> #include <OneWire.h> #include <DallasTemperature.h> //DS18B20 support // =========== Setup the Temperature sensor details ================= #define TEMPERATURE_PRECISION 9 // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWireA (6) ; // 2 sensor on pin6 OneWire oneWireB (7) ; // 2 sensor on pin7 // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensorsA (&oneWireA) ; DallasTemperature sensorsB (&oneWireB) ; // Insert the ID of your temp sensor here, for the sketch, visit here // http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html DeviceAddress inside = { 0x28, 0xFF, 0x1F, 0x8A, 0x4E, 0x04, 0x00, 0x67 }; DeviceAddress outside = { 0x28, 0xFF, 0x03, 0x4A, 0x33, 0x04, 0x00, 0xFC }; DeviceAddress dogHouse = { 0x28, 0xFF, 0xE2, 0x44, 0x31, 0x04, 0x00, 0xB1 }; DeviceAddress cathouse = { 0x28, 0xFF, 0xED, 0x89, 0x4E, 0x04, 0x00, 0xCA }; // ethernet interface mac address, must be unique on the LAN byte mymac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; const char website[] PROGMEM = "api.thingspeak.com"; byte Ethernet::buffer[700]; uint32_t timer; Stash stash; void setup () { Serial.begin(57600); Serial.println("\n[webClient]"); if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) Serial.println( "Failed to access Ethernet controller"); if (!ether.dhcpSetup()) Serial.println("DHCP failed"); ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip); if (!ether.dnsLookup(website)) Serial.println("DNS failed"); ether.printIp("SRV: ", ether.hisip); } void loop () { ether.packetLoop(ether.packetReceive()); if (millis() > timer) { timer = millis() + 15000; //Transmit every minute // themperatures from all sensors sensorsA.requestTemperatures(); sensorsB.requestTemperatures(); // save themperatures to values float aThermometer = sensorsA.getTempC(inside); float aThermometer1 = sensorsA.getTempC(outside); float aThermometer2 = sensorsB.getTempC(dogHouse); float aThermometer3 = sensorsB.getTempC(cathouse); delay(200); // generate two fake values as payload - by using a separate stash, // we can determine the size of the generated message ahead of time byte sd = stash.create(); // create text with values for THINGSPEAK with more fields stash.print("field1="); stash.println(aThermometer); stash.print("&field2="); stash.println(aThermometer1); stash.print("&field3="); stash.println(aThermometer2); stash.print("&field4="); stash.println(aThermometer3); stash.save(); // generate the header with payload - note that the stash size is used, // and that a "stash descriptor" is passed in as argument using "$H" Stash::prepare(PSTR("POST /update HTTP/1.1" "\r\n" "Host: $F" "\r\n" "Connection: close" "\r\n" "X-THINGSPEAKAPIKEY: $F" "\r\n" "Content-Type: application/x-www-form-urlencoded" "\r\n" "Content-Length: $D" "\r\n" "\r\n" "$H"), website, PSTR(APIKEY), stash.size(), sd); // send the packet - this also releases all stash buffers once done ether.tcpSend(); } }
—–
web_tepl_thingspeak 2 sensors.ino
2 senzory na jednom pine/* | Post temp. values from a DS18B20 to ThingSpeak using the Ethercard interface based on the | ENC28J60 chip. ethercard arduino 1.6.4 <EtherCard.h> from master | Based on the Ethercard example from www.jeelabs.org | enc28j60 CS is pin 8 | library ethercard from master , ethercardmaster.zip | Phil Grant Jan 2014 */ #include <EtherCard.h> // change these settings to match your own setup #define APIKEY "C06FVBVE5DCU0UK1 " // plug your API KEY #include <Wire.h> #include <OneWire.h> #include <DallasTemperature.h> //DS18B20 support // =========== Setup the Temperature sensor details ================= #define ONE_WIRE_BUS 7 // DS18B20 Temperature chip i/o on pin D7, plug sensors to PIN D7, or change value #define TEMPERATURE_PRECISION 9 // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); // Insert the ID of your temp sensor here, for the sketch, visit here // http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html DeviceAddress Thermometer = { 0x28, 0x5C, 0x46, 0xB4, 0x01, 0x00, 0x00, 0x0C }; // ds18b20 address, replace with your address DeviceAddress Thermometer1 = { 0x28, 0xFF, 0xE2, 0x44, 0x31, 0x04, 0x00, 0xB1 }; // ds18b20 address,replace with your address you can others sensors // you can others sensors // ethernet interface mac address, must be unique on the LAN byte mymac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; const char website[] PROGMEM = "api.thingspeak.com"; byte Ethernet::buffer[700]; uint32_t timer; Stash stash; void setup () { Serial.begin(57600); Serial.println("\n[webClient]"); if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) Serial.println( "Failed to access Ethernet controller"); if (!ether.dhcpSetup()) Serial.println("DHCP failed"); ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip); if (!ether.dnsLookup(website)) Serial.println("DNS failed"); ether.printIp("SRV: ", ether.hisip); } void loop () { ether.packetLoop(ether.packetReceive()); if (millis() > timer) { timer = millis() + 15000; //Transmit every minute // themperatures from all sensors sensors.requestTemperatures(); // save themperatures to values float aThermometer = sensors.getTempC(Thermometer); float aThermometer1 = sensors.getTempC(Thermometer1); delay(200); // generate two fake values as payload - by using a separate stash, // we can determine the size of the generated message ahead of time byte sd = stash.create(); // create text with values for THINGSPEAK with more fields stash.print("field1="); stash.println(aThermometer); stash.print("&field2="); stash.println(aThermometer1); stash.save(); // generate the header with payload - note that the stash size is used, // and that a "stash descriptor" is passed in as argument using "$H" Stash::prepare(PSTR("POST /update HTTP/1.1" "\r\n" "Host: $F" "\r\n" "Connection: close" "\r\n" "X-THINGSPEAKAPIKEY: $F" "\r\n" "Content-Type: application/x-www-form-urlencoded" "\r\n" "Content-Length: $D" "\r\n" "\r\n" "$H"), website, PSTR(APIKEY), stash.size(), sd); // send the packet - this also releases all stash buffers once done ether.tcpSend(); } }
RomanB
ÚčastníkZdravím, IP adresa se musí zadat tak trochu jinak, než je napsaná v tutoriálu. Pokud je Ethernet shield zapojen přes UTP kabel do WiFi routeru a router je nakonfigurován tak, aby DHCP přiděloval IP, potom si zjisti rozsah přidělovaných adres a nějakou tu adresu do nastavení vepiš.
Třeba u mě to je IPAddress ip(192,168,0,111);
Potom bych ještě zapsal v setupu Ethernet.begin(mac, ip);charlie12
ÚčastníkTak jsem na to přišel. Nebyl inicializovaný displej a nebylo zapnuté podsvícení.
Kód vypadá takhle:
#include <LiquidCrystal_I2C.h>
#include „DHT.h“
#include <Wire.h>LiquidCrystal_I2C lcd(0x27,16,2);
#define DHTPIN 2
#define DHTTYPE DHT22
#define fan 4int maxHum = 60;
int maxTemp = 40;DHT dht(DHTPIN, DHTTYPE);
void setup() {
lcd.init();
lcd.backlight();
Serial.begin(9600);
dht.begin();
}void loop() {
float t = dht.readTemperature();
float h = dht.readHumidity();
delay(5000);t = ((float)t)-3;
if (isnan(t) || isnan(h)) {
lcd.setCursor(5,1);
lcd.println(„fail“);
} else {
lcd.setCursor(0,0);
lcd.print(t);
lcd.print(“ Centigrade“);
lcd.setCursor(0,1);
lcd.print(h);
lcd.print(“ Humidity“);
Serial.print(t);
Serial.print(“ Centigrade“);
Serial.print(“ „);
Serial.print(h);
Serial.println(“ Humidity“);
}
}Jsou v něm nějaké chyby, které by šli udělat jinak jednodušeji?
Díky 🙂charlie12
ÚčastníkTento kód jsem zkoušel již předevčírem. Kompilace i nahrání do Arduina proběhne v pořádku, sériový monitor funguje, jen displej nereaguje, ani neproblikne. Adresu displeje mám správnou. Zapojený je Nevíte kde by mohla být chyba?
Díky 🙂Aleš
ÚčastníkAuto se odrušuje strašně blbě 🙁 Zkusit nějaké cívky a kondenzátory, co nejblíže k napájení Arduina. A hlavně co nekratší ten datový drát. Všecny vodiče omotat okolo něčeho takového: http://cz.rs-online.com/web/c/pasivni-soucasti/feritova-jadra/feritove-trubicky/
Pro napájení použít „auto adaptér„, ale podívat se dovnitř, jestli je osazený nějakým MC34063 obvodem. Ten dokáže docela rušení také potlačit. Chce to dělat pokusy, když není osciloskop 🙁Aleš
ÚčastníkStrýček Google nefunguje?
např. https://codebender.cc/sketch:58994hcdady
ÚčastníkDobrý den, ještě jeden dotaz myslíte, že kdybych tam vložil dělič impulzů jako něco takového http://www.matt.pl/files/18857/MATT-ULT001-1107.1.0.0-PS4_EN.pdf,
že by to pomohlo.¨
Za pomoc děkuji Davidhcdady
ÚčastníkDobrý den, tak je to opravdu dobíjením, ale je zajímavé, že na automobilu jsou motory 2 jeden hlavní automobilu a druhý menší pro pohon nástavby a u něj to rušení je minimální. Chtěl jsem se zeptat jestli by nešlo udělat nějaký obvod pro odrušení šumů z alternátorů. Zkusím ještě poptat výrobce na odrušení přímo na alternátor.
jarin
ÚčastníkTak ty rezistory pomohli, u una funguje bez nich. Díky za radu
lukbe
ÚčastníkTakže teď tu hodnotu teda výčtu z dht22 do float, vynasobim 100 a potom na char pomocí dtostrf? A na přijímací straně, příjmu char a do float jak pomoci atoi ?
lukbe
ÚčastníkZde nový odkaz https://www.dropbox.com/sh/xh4gozx9z1e99ex/AADLfYeh7bN4FJFNJdmKR2ESa?dl=0
Jinak děkuji za myšlenku zní to dobře a určitě to bude fungovat….
Aleš
ÚčastníkTy vaše soubory z dropboxu nejdou stáhnout. Ale pokud se dobře pamatuju z pokusů s tímto modulem, tak umí odesílat jenom čísla. Takže myslím, že se to dělá tak, že hodnotu vynásobíte 100, převedete na int, odešlete, a v přijímači opět vydělíte 100.
Zbyšek Voda
ÚčastníkJsem rád, že se Vám to povedlo 🙂
thehekycz
ÚčastníkMáte pravdu, fungujte to. Moc vám děkuju, už jsem byl opravdu zoufalý 🙂
Zbyšek Voda
ÚčastníkDobrý den,
ještě bych to nevzdával 🙂
Problém asi bude v tom, že se nejedná o originální Arduino, ale o klon. A klony jsou často vybavené jiným USB převodníkem, než oficiální desky. Takže ovladače zahrnuté v Arduino IDE jsou v tomto případě k ničemu.
Zkuste si odsud http://www.arduined.eu/files/CH341SER.zip stáhnout ovladač. Rozbalte stažený ZIP archiv.
Poté klikněte pravým na USB2.0-Serial ve správci zařízení a vyberte Aktualizovat software ovladače. Poté naveďte instalační program na stažený a rozbalený archiv.Iver
ÚčastníkDobrý den,
zaujal mne váš nápad na laserovou detekci okolí. Aktuálně připravuji jeden projekt, jehož součástí je tato potřeba detekce okolí taktéž a to jak echolokace, tak i pomocí laseru a zabudované HD kamery. Možná by nebylo od věci prodiskutovat vzájemně naše nápady a popřípadě je sloučit do jednoho funkčního celku. Veškeré informace naleznete na https://bastlirna.hwkitchen.cz/forum/tema/humanoidni-socialni-robot/.S pozdravem
Tomáš TřískaIver
ÚčastníkDobrý den,
zaujal mne váš nápad na domácí automatizaci. Aktuálně připravuji jeden projekt, jehož součástí je tato automatizace taktéž. Možná by nebylo od věci prodiskutovat vzájemně naše nápady a popřípadě je sloučit do jednoho funkčního celku. Veškeré informace naleznete na https://bastlirna.hwkitchen.cz/forum/tema/humanoidni-socialni-robot/.S pozdravem
Tomáš TřískaOldřich Horáček
SprávceAhoj,
pokud je ten LED display s LEDkama různých barev, tak ten rozdíl je způsobený tím, že každá barva vyžaduje jiný předřadný odpor podle napětí na LED diodě. Tak aby tekl LEDkama stejný proud. Každá barva má trochu jiné napětí. Navíc lidské oko je jinak citlivé na různé barvy, tak je potřeba to vždycky doladit „na místě“. Pokud jsou ale LEDky stejných barev a svítí jinak, tak je to divné :-).Zbyšek Voda
ÚčastníkJde to.
int pole[3][3] = {{1,2,3},
{4,5,6},
{7,8,9}};Zbyšek Voda
ÚčastníkJeště zkuste připojit k oběma linkám (SDA i SCL) pullup rezistor 4,7 kOhm.
Viz https://bastlirna.hwkitchen.cz/propojujeme-arduino-s-jinym-i-zarizenimi/ část Sběrnice I2C.terje
Účastník/*
| Post temp. values from a DS18B20 to ThingSpeak using the Ethercard interface based on the
| ENC28J60 chip.
| Based on the Ethercard example from http://www.jeelabs.org
| Phil Grant Jan 2014
*/
#include <EtherCard.h>
// change these settings to match your own setup
#define APIKEY „KVWMM6N5UOKA7SR4“ // ThingSpeak Chanel 21973
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h> //DS18B20 support
// =========== Setup the Temperature sensor details =================
#define ONE_WIRE_BUS 7 // DS18B20 Temperature chip i/o on pin D7
#define TEMPERATURE_PRECISION 9
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Insert the ID of your temp sensor here, for the sketch, visit here
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
DeviceAddress Thermometer = { 0x28, 0xBC, 0x28, 0xF9, 0x03, 0x00, 0x00, 0xA4 }; // zelena, adresa: 0x28, 0xBC, 0x28, 0xF9, 0x03, 0x00, 0x00, 0xA4int sensorPin = A0; // select the input pin for the ldr
unsigned int sensorValue = 0; // variable to store the value coming from the ldr// ethernet interface mac address, must be unique on the LAN
byte mymac[] = { 0xDE,0xAD,0xBE,0xEF,0xFE,0xED };const char website[] PROGMEM = „api.thingspeak.com“;
byte Ethernet::buffer[700];
uint32_t timer;
Stash stash;void setup () {
Serial.begin(57600);
Serial.println(„\n[webClient]“);if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
Serial.println( „Failed to access Ethernet controller“);
if (!ether.dhcpSetup())
Serial.println(„DHCP failed“);ether.printIp(„IP: „, ether.myip);
ether.printIp(„GW: „, ether.gwip);
ether.printIp(„DNS: „, ether.dnsip);if (!ether.dnsLookup(website))
Serial.println(„DNS failed“);ether.printIp(„SRV: „, ether.hisip);
}void loop () {
ether.packetLoop(ether.packetReceive());if (millis() > timer) {
//timer = millis() + 60000; //Transmit every 60 seconds
timer = millis() + 30000; //Transmit every 30 seconds
sensors.requestTemperatures();
delay(200);
// read the value from the ldr:
sensorValue = analogRead(sensorPin);
// generate two values – by using a separate stash,
// we can determine the size of the generated message ahead of time
byte sd = stash.create();
stash.print(„field1=“);
stash.println(String(sensors.getTempC(Thermometer),DEC)); // print the temperature as string
stash.print(„&field2=“);
stash.print(String(sensorValue, DEC)); // print the value (0 to 1024) as string
stash.save();
// For DEBUGGING – Print out our data, uncomment the lines below
//Serial.print(„field1=“);
//Serial.println(sensors.getTempC(Thermometer),DEC);
//Serial.print(„field2=“);
//Serial.println(sensorValue, DEC); // print the value (0 to 1024)// generate the header with payload – note that the stash size is used,
// and that a „stash descriptor“ is passed in as argument using „$H“
Stash::prepare(PSTR(„POST /update HTTP/1.1“ „\r\n“
„Host: $F“ „\r\n“
„Connection: close“ „\r\n“
„X-THINGSPEAKAPIKEY: $F“ „\r\n“
„Content-Type: application/x-www-form-urlencoded“ „\r\n“
„Content-Length: $D“ „\r\n“
„\r\n“
„$H“),
website, PSTR(APIKEY), stash.size(), sd);// send the packet – this also releases all stash buffers once done
ether.tcpSend();
}
}Luke_CZ
ÚčastníkPředpokládám, že to DO bude mít plovoucí kód. Tož to bude asi těžko řešitelný.
Ondra78
ÚčastníkPostni sem kód
terje
ÚčastníkSkončil jsem na tomhle.
[url=http://postimg.org/image/yexblf1y3/][img]http://s17.postimg.org/yexblf1y3/Bez_n_zvu.jpg[/img][/url]
Ondra78
ÚčastníkJá vkládám obrázky přes http://postimage.org/
terje
Účastníkneumím do příspěvku vložit obrázek. už jsem zkoušel všecho možné
jarin
ÚčastníkFotka připojení
-
AutorPříspěvky