Hi there
i would like to use my photon to read temperature and humidity, but i don’t understand what is the simplest way for me to read this information?
let’s say i want to see 2 graphs, 1 for the temperature and 1 for the humidity, how do i do it?
Have you tried searching this community yet? There are numerous examples to be found, and you can just as easily find them by looking as I can
You can use 3th party services, native apps, webpages… Depends on what you’re comfortable with and how skilled you are to make it.
yes, i see in the forums a lot of options. i tried to work with it but it is too complicated for me to understand.
i tried to use Blynk app, and i also tried to use the dashboard, but with no luck.
for example, how can i see more than 1 graph on the dashboard?
i managed to upload the demo too, but i didn’t manage to upload my code using Blynk.
can you explain me how to upload my own code and see the results using Blink?
i have uploaded the 01-particle.ino example (i attached it here).
i changed the token and the photon connected to the app on my iphone.
But…
i didn’t manage to upload my own code. i tried to delete the code in the example and write there my code, but it didn’t go.
let’s say i want a very simple example. i want my code to have 1 integer (let’s say i=5) so i can see it on my Blynk app.
how can i learn how to do it? because everything i tried failed.
thank you very much
Jon
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads, docs, tutorials: http://www.blynk.cc
* Blynk community: http://community.blynk.cc
* Social groups: http://www.fb.com/blynkapp
* http://twitter.com/blynk_app
*
* Blynk library is licensed under MIT license
* This example code is in public domain.
*
* WARNING: It is recommended to use SparkCorePolledTimer library
* to make periodic actions (similar to SimpleTimer on Arduino).
*
**************************************************************/
//#define BLYNK_DEBUG // Uncomment this to see debug prints
#define BLYNK_PRINT Serial
#include "blynk/blynk.h"
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "1403619bbd2447f08bd9ff83252e81f4";
// Attach a Button widget (mode: Switch) to the Digital pin 7 - and control the built-in blue led.
// Attach a Graph widget to Analog pin 1
// Attach a Gauge widget to Analog pin 2
// No coding is required for direct pin operations!
void setup()
{
Serial.begin(9600);
delay(5000); // Allow board to settle
Blynk.begin(auth);
}
// Attach a Button widget (mode: Push) to the Virtual pin 1 - and send sweet tweets!
BLYNK_WRITE(V1) {
if (param.asInt() == 1) { // On button down...
// Tweeting!
// Note:
// We allow 1 tweet per minute for now.
// Twitter doesn't allow identical subsequent messages.
Blynk.tweet("My Particle project is tweeting using @blynk_app and it’s awesome!\n @Particle #IoT #blynk");
// Pushing notification to the app!
// Note:
// We allow 1 notification per minute for now.
Blynk.notify("You pressed the button and I know it ;)");
}
}
// Attach a Slider widget to the Virtual pin 2 - and control the built-in RGB led!
BLYNK_WRITE(V2) {
if (param.asInt() > 0) {
RGB.control(true);
byte rgb[3];
HsvToRgb(param.asDouble()/255, 1, 1, rgb);
RGB.color(rgb[0], rgb[1], rgb[2]);
} else {
RGB.control(false);
}
}
void loop()
{
Blynk.run();
if (ModeBtnPressed()) {
Blynk.notify("Mode button was pressed");
}
}
// *** Utility functions
bool ModeBtnPressed() {
if(millis() > 5000) {
if(BUTTON_GetDebouncedTime(BUTTON1) >= 50) {
BUTTON_ResetDebouncedState(BUTTON1);
return 1;
}
}
return 0;
}
void HsvToRgb(double h, double s, double v, byte rgb[]) {
double r, g, b;
int i = int(h * 6);
double f = h * 6 - i;
double p = v * (1 - s);
double q = v * (1 - f * s);
double t = v * (1 - (1 - f) * s);
switch(i % 6){
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
rgb[0] = r * 255;
rgb[1] = g * 255;
rgb[2] = b * 255;
}
i tried to edit it, but than it didn’t go.
i think i don’t understand what i am allowed to delete in the code and what not.
can you please show me what i can not delete from this example?
Maybe before deleting stuff, you just add your extras (bit by bit in baby steps) and only after you got this working, you delete stuff you don’t know what it does (or you just leave it in )
First of all, thank you all very much for the help.
Believe me, i tried to read everything online but it is very complicated for beginners, because most of the explanations are for guys with much more experience than me.
i think i have something very basic which i didn’t understand -
how can i see the information on Blynk.
can you just explain me what the next code means? i think if i understand it it will solve all my problem.
thank you very much for the help
BLYNK_WRITE(V1) {
if (param.asInt() == 1) { // On button down...
// Tweeting!
// Note:
// We allow 1 tweet per minute for now.
// Twitter doesn't allow identical subsequent messages.
Blynk.tweet("My Particle project is tweeting using @blynk_app and it’s awesome!\n @Particle #IoT #blynk");
// Pushing notification to the app!
// Note:
// We allow 1 notification per minute for now.
Blynk.notify("You pressed the button and I know it ;)");
}
}
What it does is kind-of in the code in the form of comments already. Try to ask more specific questions. Things like:“tell me how to build a remote logging system” is a bit broad, much like:“explain to me how this code works”.
Are there specific things you’re having issues with? If so, ask that, in as much detail as possible, and include any and all information you have. We especially like to see things you’ve already tried yourself. If you get stuck somewhere, let us know where, rather than saying “it doesn’t work, could you fix it for me”. That doesn’t tell us anything, nor does it help us help you.
You might want to try following this example, it seems to work nicely, and is rather easy to follow.
The BLYNK_WRITE() is some kind of macro that wraps up the declaration and exposition of a Particle.function() and its implementation in one block.
In the Blynk app you can then tie this function to a virtual pin (e.g. V1) and when you activate the app component that calls this function with the parameter 1 the code will be executed to do what the comment says.
In order to send a value back to the Blynk app, you’d also use a virtual pin (e.g. V3) and write something like this in your firmware loop()
i = analogRead(somePin) / 123.4;
Blynk.virtualWrite(V3, i);
And attach some display widget in the Blynk app to V3.
hi Guys, i still have a problem, if i can use your help…
i write the most basic code, and i flash it and i control the Photon with no problem.
BUT, when i try to add some code line, for example
Blynk.virtualWrite(V2, “abc”);
the flash does not go.
i verify the code and the flashing goes ok, but the app say that the photon is off-line.
when i delete this line the problem solves.
i try to use other codes, like -
lcd.print(0, 0, “Your Message”);
but it gives the same problem.
i try and i try but i don’t see what am i doing wrong