Wifi bordje
20 berichten
• Pagina 2 van 2 • 1, 2
Re: Wifi bordje
ik zie daar niks enkel com 3 en dat is het , zal je even kunnen zien via facebook ofzo
Advertisement
Re: Wifi bordje
In de Arduino IDE in het menu onder "Hulpmiddelen" zie je "Seriële monitor".
Als je daar op klikt terwijl het boardje is verbonden met de computer dan opent de seriële monitor.
Druk daarna op RESET op het boardje, en je ziet wat er gebeurt.
Het is een leuk project. Ik weet niet of het werkt, want dit zijn serieuze verbeteringen: https://github.com/witnessmenow/simple-arduino-crypto-display/pull/3.
Als je probeert om in één keer iets werkend te krijgen, dan kun je vastlopen. Arduino is bedoeld om te leren programmeren, om snel iets in elkaar te zetten, en al gaandeweg het steeds leuker te gaan vinden
Als je daar op klikt terwijl het boardje is verbonden met de computer dan opent de seriële monitor.
Druk daarna op RESET op het boardje, en je ziet wat er gebeurt.
Het is een leuk project. Ik weet niet of het werkt, want dit zijn serieuze verbeteringen: https://github.com/witnessmenow/simple-arduino-crypto-display/pull/3.
Als je probeert om in één keer iets werkend te krijgen, dan kun je vastlopen. Arduino is bedoeld om te leren programmeren, om snel iets in elkaar te zetten, en al gaandeweg het steeds leuker te gaan vinden
Re: Wifi bordje
die rode dingen weg halen en vervangen dan?
ik weet ook niet dat het firmware juist is dat op het bordje staat mvg
ik weet ook niet dat het firmware juist is dat op het bordje staat mvg
Re: Wifi bordje
Sorry, maar ik weet echt niet wat je met rode dingen bedoelt.
Er zijn veel officiële Arduino boards, maar ook allerlei clones en "compatible" boards. Er zijn talloze boeken, startker-kits, sensor-modules, enzovoorts. Er zijn op internet duizenden voorbeelden, die niet allemaal correct zijn.
Je zult dus echt moeten vertellen wat je hebt en wat je doet, want wij hebben geen idee.
Ik zou als het ware over je schouder mee willen kijken, daarom wil ik heel veel weten.
Als iemand een komma in een sketch anders zet, dan heb ik het liefst dat diegene de hele sketch weer laat zien.
Er zijn veel officiële Arduino boards, maar ook allerlei clones en "compatible" boards. Er zijn talloze boeken, startker-kits, sensor-modules, enzovoorts. Er zijn op internet duizenden voorbeelden, die niet allemaal correct zijn.
Je zult dus echt moeten vertellen wat je hebt en wat je doet, want wij hebben geen idee.
Ik zou als het ware over je schouder mee willen kijken, daarom wil ik heel veel weten.
Als iemand een komma in een sketch anders zet, dan heb ik het liefst dat diegene de hele sketch weer laat zien.
Re: Wifi bordje
/*******************************************************************
A project to display crypto currency prices using an ESP8266
Main Hardware:
- NodeMCU Development Board (Any ESP8266 dev board will work)
- OLED I2C Display (SH1106)
Written by Brian Lough
https://www.youtube.com/channel/UCezJOf ... d5xrP3q6WA
*******************************************************************/
// ----------------------------
// Standard Libraries - Already Installed if you have ESP8266 set up
// ----------------------------
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <Wire.h>
// ----------------------------
// Additional Libraries - each one of these will need to be installed.
// ----------------------------
#include <CoinMarketCapApi.h>
// For Integrating with the CoinMarketCap.com API
// Available on the library manager (Search for "CoinMarket")
// https://github.com/witnessmenow/arduino ... ketcap-api
#include "SH1106.h"
// The driver for the OLED display
// Available on the library manager (Search for "oled ssd1306")
// https://github.com/squix78/esp8266-oled-ssd1306
#include <ArduinoJson.h>
// !! NOTE !!: When installing this select an older version than V6 from the drop down
// Required by the CoinMarketCapApi Library for parsing the response
// Available on the library manager (Search for "arduino json")
// https://github.com/squix78/esp8266-oled-ssd1306
// ----------------------------
// Configurations - Update these
// ----------------------------
char ssid[] = "WiFiNetworkName"; // your network SSID (name)
char password[] = "password"; // your network key
// Pins based on your wiring
#define SCL_PIN D5
#define SDA_PIN D3
// CoinMarketCap's limit is "no more than 10 per minute"
// Make sure to factor in if you are requesting more than one coin.
// We'll request a new value just before we change the screen so it's the most up to date
unsigned long screenChangeDelay = 10000; // Every 10 seconds
// Have tested up to 10, can probably do more
#define MAX_HOLDINGS 10
#define CURRENCY "eur" //See CoinMarketCap.com for currency options (usd, gbp etc)
#define CURRENCY_SYMBOL "E" // Euro doesn't seem to work, $ and £ do
// You also need to add your crypto currecnies in the setup function
// ----------------------------
// End of area you need to change
// ----------------------------
WiFiClientSecure client;
CoinMarketCapApi api(client);
SH1106 display(0x3c, SDA_PIN, SCL_PIN);
unsigned long screenChangeDue;
struct Holding {
String tickerId;
float amount;
bool inUse;
CMCTickerResponse lastResponse;
};
Holding holdings[MAX_HOLDINGS];
int currentIndex = -1;
String ipAddressString;
void addNewHolding(String tickerId, float amount = 0) {
int index = getNextFreeHoldingIndex();
if (index > -1) {
holdings[index].tickerId = tickerId;
holdings[index].amount = amount;
holdings[index].inUse = true;
}
}
void setup() {
Serial.begin(115200);
// ----------------------------
// Holdings - Add your currencies here
// ----------------------------
// Go to the currencies coinmarketcap.com page
// and take the tickerId from the URL (use bitcoin or ethereum as an example)
addNewHolding("bitcoin");
addNewHolding("dogecoin");
addNewHolding("ethereum");
// ----------------------------
// Everything below can be thinkered with if you want but should work as is!
// ----------------------------
// Initialising the display
display.init();
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setFont(ArialMT_Plain_16);
display.drawString(64, 0, F("HODL Display"));
display.setFont(ArialMT_Plain_10);
display.drawString(64, 18, F("By Brian Lough"));
display.display();
// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
IPAddress ip = WiFi.localIP();
Serial.println(ip);
ipAddressString = ip.toString();
}
int getNextFreeHoldingIndex() {
for (int i = 0; i < MAX_HOLDINGS; i++) {
if (!holdings[i].inUse) {
return i;
}
}
return -1;
}
int getNextIndex() {
for (int i = currentIndex + 1; i < MAX_HOLDINGS; i++) {
if (holdings[i].inUse) {
return i;
}
}
for (int j = 0; j <= currentIndex; j++) {
if (holdings[j].inUse) {
return j;
}
}
return -1;
}
void displayHolding(int index) {
CMCTickerResponse response = holdings[index].lastResponse;
display.clear();
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setFont(ArialMT_Plain_16);
display.drawString(64, 0, response.symbol);
display.setFont(ArialMT_Plain_24);
double price = response.price_currency;
if (price == 0) {
price = response.price_usd;
}
display.drawString(64, 20, formatCurrency(price));
display.setFont(ArialMT_Plain_16);
// display.setTextAlignment(TEXT_ALIGN_CENTER);
// display.drawString(64, 48, " 1h:" + String(response.percent_change_1h) + "%");
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.drawString(64, 48, "24h: " + String(response.percent_change_24h) + "%");
display.display();
}
void displayMessage(String message){
display.clear();
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawStringMaxWidth(0, 0, 128, message);
display.display();
}
String formatCurrency(float price) {
String formattedCurrency = CURRENCY_SYMBOL;
int pointsAfterDecimal = 6;
if (price > 100) {
pointsAfterDecimal = 2;
} else if (price > 1) {
pointsAfterDecimal = 4;
}
formattedCurrency.concat(String(price, pointsAfterDecimal));
return formattedCurrency;
}
bool loadDataForHolding(int index) {
int nextIndex = getNextIndex();
if (nextIndex > -1 ) {
holdings[index].lastResponse = api.GetTickerInfo(holdings[index].tickerId, CURRENCY);
return holdings[index].lastResponse.error == "";
}
return false;
}
void loop() {
unsigned long timeNow = millis();
if ((timeNow > screenChangeDue)) {
currentIndex = getNextIndex();
if (currentIndex > -1) {
if (loadDataForHolding(currentIndex)) {
displayHolding(currentIndex);
} else {
displayMessage(F("Error loading data."));
}
} else {
displayMessage(F("No funds to display. Edit the setup to add them"));
}
screenChangeDue = timeNow + screenChangeDelay;
}
}
A project to display crypto currency prices using an ESP8266
Main Hardware:
- NodeMCU Development Board (Any ESP8266 dev board will work)
- OLED I2C Display (SH1106)
Written by Brian Lough
https://www.youtube.com/channel/UCezJOf ... d5xrP3q6WA
*******************************************************************/
// ----------------------------
// Standard Libraries - Already Installed if you have ESP8266 set up
// ----------------------------
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <Wire.h>
// ----------------------------
// Additional Libraries - each one of these will need to be installed.
// ----------------------------
#include <CoinMarketCapApi.h>
// For Integrating with the CoinMarketCap.com API
// Available on the library manager (Search for "CoinMarket")
// https://github.com/witnessmenow/arduino ... ketcap-api
#include "SH1106.h"
// The driver for the OLED display
// Available on the library manager (Search for "oled ssd1306")
// https://github.com/squix78/esp8266-oled-ssd1306
#include <ArduinoJson.h>
// !! NOTE !!: When installing this select an older version than V6 from the drop down
// Required by the CoinMarketCapApi Library for parsing the response
// Available on the library manager (Search for "arduino json")
// https://github.com/squix78/esp8266-oled-ssd1306
// ----------------------------
// Configurations - Update these
// ----------------------------
char ssid[] = "WiFiNetworkName"; // your network SSID (name)
char password[] = "password"; // your network key
// Pins based on your wiring
#define SCL_PIN D5
#define SDA_PIN D3
// CoinMarketCap's limit is "no more than 10 per minute"
// Make sure to factor in if you are requesting more than one coin.
// We'll request a new value just before we change the screen so it's the most up to date
unsigned long screenChangeDelay = 10000; // Every 10 seconds
// Have tested up to 10, can probably do more
#define MAX_HOLDINGS 10
#define CURRENCY "eur" //See CoinMarketCap.com for currency options (usd, gbp etc)
#define CURRENCY_SYMBOL "E" // Euro doesn't seem to work, $ and £ do
// You also need to add your crypto currecnies in the setup function
// ----------------------------
// End of area you need to change
// ----------------------------
WiFiClientSecure client;
CoinMarketCapApi api(client);
SH1106 display(0x3c, SDA_PIN, SCL_PIN);
unsigned long screenChangeDue;
struct Holding {
String tickerId;
float amount;
bool inUse;
CMCTickerResponse lastResponse;
};
Holding holdings[MAX_HOLDINGS];
int currentIndex = -1;
String ipAddressString;
void addNewHolding(String tickerId, float amount = 0) {
int index = getNextFreeHoldingIndex();
if (index > -1) {
holdings[index].tickerId = tickerId;
holdings[index].amount = amount;
holdings[index].inUse = true;
}
}
void setup() {
Serial.begin(115200);
// ----------------------------
// Holdings - Add your currencies here
// ----------------------------
// Go to the currencies coinmarketcap.com page
// and take the tickerId from the URL (use bitcoin or ethereum as an example)
addNewHolding("bitcoin");
addNewHolding("dogecoin");
addNewHolding("ethereum");
// ----------------------------
// Everything below can be thinkered with if you want but should work as is!
// ----------------------------
// Initialising the display
display.init();
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setFont(ArialMT_Plain_16);
display.drawString(64, 0, F("HODL Display"));
display.setFont(ArialMT_Plain_10);
display.drawString(64, 18, F("By Brian Lough"));
display.display();
// Set WiFi to station mode and disconnect from an AP if it was Previously
// connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// Attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
IPAddress ip = WiFi.localIP();
Serial.println(ip);
ipAddressString = ip.toString();
}
int getNextFreeHoldingIndex() {
for (int i = 0; i < MAX_HOLDINGS; i++) {
if (!holdings[i].inUse) {
return i;
}
}
return -1;
}
int getNextIndex() {
for (int i = currentIndex + 1; i < MAX_HOLDINGS; i++) {
if (holdings[i].inUse) {
return i;
}
}
for (int j = 0; j <= currentIndex; j++) {
if (holdings[j].inUse) {
return j;
}
}
return -1;
}
void displayHolding(int index) {
CMCTickerResponse response = holdings[index].lastResponse;
display.clear();
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setFont(ArialMT_Plain_16);
display.drawString(64, 0, response.symbol);
display.setFont(ArialMT_Plain_24);
double price = response.price_currency;
if (price == 0) {
price = response.price_usd;
}
display.drawString(64, 20, formatCurrency(price));
display.setFont(ArialMT_Plain_16);
// display.setTextAlignment(TEXT_ALIGN_CENTER);
// display.drawString(64, 48, " 1h:" + String(response.percent_change_1h) + "%");
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.drawString(64, 48, "24h: " + String(response.percent_change_24h) + "%");
display.display();
}
void displayMessage(String message){
display.clear();
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawStringMaxWidth(0, 0, 128, message);
display.display();
}
String formatCurrency(float price) {
String formattedCurrency = CURRENCY_SYMBOL;
int pointsAfterDecimal = 6;
if (price > 100) {
pointsAfterDecimal = 2;
} else if (price > 1) {
pointsAfterDecimal = 4;
}
formattedCurrency.concat(String(price, pointsAfterDecimal));
return formattedCurrency;
}
bool loadDataForHolding(int index) {
int nextIndex = getNextIndex();
if (nextIndex > -1 ) {
holdings[index].lastResponse = api.GetTickerInfo(holdings[index].tickerId, CURRENCY);
return holdings[index].lastResponse.error == "";
}
return false;
}
void loop() {
unsigned long timeNow = millis();
if ((timeNow > screenChangeDue)) {
currentIndex = getNextIndex();
if (currentIndex > -1) {
if (loadDataForHolding(currentIndex)) {
displayHolding(currentIndex);
} else {
displayMessage(F("Error loading data."));
}
} else {
displayMessage(F("No funds to display. Edit the setup to add them"));
}
screenChangeDue = timeNow + screenChangeDelay;
}
}
Re: Wifi bordje
dit is mijn foutcode
Arduino: 1.8.8 (Windows 10), Board:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp:70:11: error: DynamicJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6
DynamicJsonBuffer jsonBuffer;
^
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp: In member function 'CMCTickerResponse CoinMarketCapApi::GetTickerInfo(String, String)':
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp:70:21: error: 'jsonBuffer' was not declared in this scope
DynamicJsonBuffer jsonBuffer;
^
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp:72:12: error: 'ArduinoJson::JsonArray' has no member named 'success'
if (root.success()) {
^
exit status 1
Fout bij het compileren voor board NodeMCU 1.0 (ESP-12E Module)
Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.
Arduino: 1.8.8 (Windows 10), Board:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp:70:11: error: DynamicJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6
DynamicJsonBuffer jsonBuffer;
^
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp: In member function 'CMCTickerResponse CoinMarketCapApi::GetTickerInfo(String, String)':
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp:70:21: error: 'jsonBuffer' was not declared in this scope
DynamicJsonBuffer jsonBuffer;
^
C:\Users\\Documents\Arduino\libraries\CoinMarketCapApi\src\CoinMarketCapApi.cpp:72:12: error: 'ArduinoJson::JsonArray' has no member named 'success'
if (root.success()) {
^
exit status 1
Fout bij het compileren voor board NodeMCU 1.0 (ESP-12E Module)
Dit rapport zou meer informatie bevatten met
"Uitgebreide uitvoer weergeven tijden compilatie"
optie aan in Bestand -> Voorkeuren.
- nicoverduin
- Berichten: 5043
- Geregistreerd: 13 Mei 2013, 20:57
- Woonplaats: Heemskerk
Re: Wifi bordje
En heb je de update al uitgevoerd zoals aangegeven? Of een oudere versie geselecteerd zoals aangegeven in de code
Re: Wifi bordje
Probleem zal opgelost zijn, blijkbaar zit er in de code iets dat ik eerst de oled scherm moet aansluiten maar die heb ik nog niet
- nicoverduin
- Berichten: 5043
- Geregistreerd: 13 Mei 2013, 20:57
- Woonplaats: Heemskerk
Re: Wifi bordje
Dat kan nooit de boodschap geven die je nu hebt. Dat scherm komt pas aan de beurt als je het programma in het bordje hebt geladen. Dit is een fout dat je verkeerde lib hebt geïnstalleerd.
20 berichten
• Pagina 2 van 2 • 1, 2
Terug naar Gezamenlijke projecten
Wie is er online?
Gebruikers in dit forum: Geen geregistreerde gebruikers en 1 gast