Go Down

Topic: Console.print proble (Read 220 times) previous topic - next topic


Jul 12, 2018, 04:07 pm Last Edit: Jul 12, 2018, 04:25 pm by oscarcuenca2
I am traying to get output using serial port but using console WIFI not COM1.

But I amg geting this error:

no matching function for call to 'ConsoleClass::begin(int)'

Line 66

Code: [Select]

sketch_jul08a.ino: In function 'void setup()':
sketch_jul08a.ino:66:19: error: no matching function for call to 'ConsoleClass::begin(int)'
sketch_jul08a.ino:66:19: note: candidate is:
In file included from sketch_jul08a.ino:5:0:
C:\Program Files (x86)\Arduino\libraries\Bridge\src/Console.h:32:10: note: void ConsoleClass::begin()
     void begin();
C:\Program Files (x86)\Arduino\libraries\Bridge\src/Console.h:32:10: note:   candidate expects 0 arguments, 1 provided
sketch_jul08a.ino: In function 'void loop()':
sketch_jul08a.ino:182:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
sketch_jul08a.ino:187:24: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
sketch_jul08a.ino: At global scope:
sketch_jul08a.ino:254:6: warning: unused parameter 'dataString2' [-Wunused-parameter]
no matching function for call to 'ConsoleClass::begin(int)'

this is the code. What I am traying is to get from the sunlight an electric signal (Mimm) with 3 leds.

Code: [Select]
#include <EEPROM.h>
#include <SD.h>
//#include <SoftwareSerial.h>
#include <SPI.h>
#include <Console.h>  //Libreria que debemos incluir
#include <Bridge.h>

// Data Buffers for the LCD
char databuff1[16];  
char databuff2[16];  
char dispbuff[16];  

// LED variables section
// Which Arduino pin goes to which LED
int redPin = A1;    
int greenPin =A2;
int bluePin=A3;

// A place to store the values coming from the analog port
int sensorValueRed =0;  
int sensorValueGreen =0;  
int sensorValueBlue = 0;

//A place to store the maximum value for each LED
int maxRed = 0;
int maxGreen =0;
int maxBlue = 0;

//EEPROM variables
// The record length is 7: 1 byte for the record number, 2 bytes
// each for the 3 LEDs.  For each additional LED you add, increase
// the record length by 2.
int record=0;
int reclen = 7;
int addr =0;

// the following variable is long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long timeSinceLastSensorHigh = 0;
int dataWritten = 0;

// music section
int notelen =40;
int dlx = notelen *1.33;

//switch to tell if an SD card is present
int SDPresent = 1;

void setup()
  // initialize serial communications at 9600 bps:
Bridge.begin();       //Puente entre el MCU y el MPU.
  // Set the Analog Pins
  // Why are we setting input pins to output?
  // We're doing this to prevent "leakage" from the pins.
  // Setting the pins to output activates a pullup resistor,
  // which makes it difficult for voltage to come into the Arduino,
  // until we're ready for it.

  Console.println("Setting up the Analog Pins");
  pinMode(redPin, OUTPUT);
  digitalWrite(redPin, LOW);
  pinMode(greenPin, OUTPUT);
  digitalWrite(greenPin, LOW);
  pinMode(bluePin, OUTPUT);
  digitalWrite(bluePin, LOW);
  // Set up SD card, let us know if SD card is absent
  pinMode(10, OUTPUT);
  if (!SD.begin(4)) delay(10);
    SDPresent =0;

  sprintf(databuff1,"Wakeup Test");

//set up EEPROM
  record = EEPROM.read(0);
  addr = (record * reclen) +1;


void loop()
  // read the value from the sensor:
    Back in setup(), we enabled a pullup resistor on the analog pins, which
    made it difficult for electricity to come into the analog pins.
    Here, we disable the pullup resistor, wait 10ms for the pin to stabilize,
    read the voltage coming into the pin, then reenable the pullup resistor.
  pinMode(redPin, INPUT);
  Console.print("Reading red:  ");
  sensorValueRed= analogRead(redPin);
  pinMode(redPin, OUTPUT);  
  pinMode(greenPin, INPUT);  
  sensorValueGreen = analogRead(greenPin);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, INPUT);
  sensorValueBlue = analogRead(bluePin);
  pinMode(bluePin, OUTPUT);

//   Console.begin(9600);
   Console.println("Comparing sensor values...");
  // Here we compare each sensor to its maximum value.
  // If any of the sensors has reached a new peak, sound a tone
  if(    (sensorValueRed>maxRed)
      || (sensorValueGreen>maxGreen)
      || (sensorValueBlue>maxBlue))
    Console.println("Máximo valor alcanzado en Rojo:");
    Console.println("Máximo valor alcanzado en Verde:");
    Console.println("Máximo valor alcanzado en Azul:");
    timeSinceLastSensorHigh = millis();

  // Here we reset the old maximum value with a new one, if necessary
  if(sensorValueRed>maxRed) maxRed = sensorValueRed;
  if(sensorValueGreen>maxGreen) maxGreen = sensorValueGreen;
  if(sensorValueBlue>maxBlue) maxBlue = sensorValueBlue;

  // Display the sensor values on the LCD screen
  sprintf(databuff1,"R%3d G%3d B%3d",maxRed,maxGreen,maxBlue);

// If 10 seconds has gone by without any new measurements, write
// data to storage.

  if(millis() > (timeSinceLastSensorHigh + 10000))
    if(dataWritten ==0)
       if(SDPresent = 1)
         writeDataToSD(databuff1, databuff2);            

void writeData()
  Console.print("I'm writing data!!!!!!!!!!!!!!!");
  EEPROM.write(0, record);
  EEPROM.write(addr++, record);
  The problems of data storage:
  The analog pins read a value from 0 to 1023. This is 1024 different values,
  and 1024 = 2 ^ 10. It would take 10 bits of data space to safely
  store the value from the analog pins.  Unfortunately, a standard byte
  of data is only 8 bits.  How can you fit 10 bits into 8 bits?
  You can't.
  What we're doing here is splitting the 10 bits of data into two sections,
  which can be stored in two bytes of memory space.
  int quotient = sensorValueRed/256;
  int mod = sensorValueRed % 256;
  quotient = sensorValueGreen/256;
  mod = sensorValueGreen % 256;
  quotient = sensorValueBlue/256;
  mod = sensorValueBlue % 256;
  dataWritten = 1;

  sprintf(databuff1,"EEPROM written");
  Console.println("FINAL BEEP");





void writeDataToSD(String dataString1, String dataString2)
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("LEDdata.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile)
    sprintf(databuff1,"SDCard written");


Jul 12, 2018, 04:10 pm Last Edit: Jul 12, 2018, 04:10 pm by pert
Don't post screenshots of text! That is very unhelpful. When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here USING CODE TAGS (</> button on the toolbar). It is almost never appropriate to post screenshots but in some cases it is helpful to post images. In those cases you should attach and embed the image following these instructions:


Dear Pert
Issue alrady solved as per your recomendation.
Thanks fro advise.


If you check the Bridge library documentation for Console.begin():
You'll see that function does not have any parameters. So Console.begin(9600) is invalid code, and thus the error. It should instead be Console.begin().

Go Up