Closed wani00 closed 1 year ago
I have same problem [ SerialBLE.begin(9600) ] not declare i take this example from blynk https://examples.blynk.cc/?board=Arduino%20Uno&shield=HC05%20or%20HC06&example=Widgets%2FLCD%2FLCD_SimpleModePushing
SoftwareSerial SwSerial(10, 11); // RX, TX
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "YourAuthToken";
BlynkTimer timer;
void sendSeconds() { Blynk.virtualWrite(V0, millis() / 1000); }
void sendMillis() { Blynk.virtualWrite(V1, millis()); }
void setup() { // Debug console Serial.begin(9600);
SerialBLE.begin(9600); Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
// Setup a function to be called every second timer.setInterval(1000L, sendSeconds); // Setup a function to be called every second timer.setInterval(1000L, sendMillis); }
void loop() { Blynk.run(); timer.run(); }
SoftwareSerial SerialBLE(10, 11); // RX, TX This is the solution for serialBLE not declared, its from another reported issue here https://github.com/blynkkk/blynk-sketch-generator/issues/95#issuecomment-648577276
BLE is currently not supported in Blynk 2.0
why my coding cannot compile because of [ SerialBLE.begin(9600) ] not declare??? i use this coding, but cannot compile:
define BLYNK_PRINT Serial
include
SoftwareSerial SwSerial(10, 11); // RX, TX
include
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "G7_TJoL9xY2yPkyYEbUVqAqHRvVfYZ34"; int fsrPin = 2; // the FSR and cap are connected to pin2 int fsrReading; // the digital reading
// Attach virtual serial terminal to Virtual Pin V1 WidgetTerminal terminal(V1);
// You can send commands from Terminal to your hardware. Just use // the same Virtual Pin as your Terminal Widget BLYNK_WRITE(V1) {
// if you type "Marco" into Terminal Widget - it will respond: "Polo:" if (String("Marco") == param.asStr()) { terminal.println("You said: 'Marco'") ; terminal.println("I said: 'Polo'") ; } else {
}
// Ensure everything is sent terminal.flush(); }
void setup() { // Debug console Serial.begin(9600);
SerialBLE.begin(9600); Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
// Clear the terminal content terminal.clear();
// This will print Blynk Software version to the Terminal Widget when // your hardware gets connected to Blynk Server terminal.println(F("Blynk v" BLYNK_VERSION ": Device started")); terminal.println(F("-------------")); terminal.println(F("Type 'Marco' and get a reply, or type")); terminal.println(F("anything else and get it printed back.")); terminal.flush(); }
void loop() { fsrReading = RCtime(fsrPin);
if (fsrReading == 30000) { // if we got 30000 that means we 'timed out' Serial.println("Nothing connected!"); } else { Serial.print("RCtime reading = "); Serial.println(fsrReading); // the raw analog reading
} delay(100); }
// Uses a digital pin to measure a resistor (like an FSR or photocell!) // We do this by having the resistor feed current into a capacitor and // counting how long it takes to get to Vcc/2 (for most arduinos, thats 2.5V) int RCtime(int RCpin) { int reading = 0; // start with 0
// set the pin to an output and pull to LOW (ground) pinMode(RCpin, OUTPUT); digitalWrite(RCpin, LOW);
// Now set the pin to an input and... pinMode(RCpin, INPUT); while (digitalRead(RCpin) == LOW) { // count how long it takes to rise up to HIGH reading++; // increment to keep track of time
} // OK either we maxed out at 30000 or hopefully got a reading, return the count
return reading; Blynk.run(); }