Code Question concerning ap_ReadAnalog

I grabbed this example:

*  ap_ReadAnalog
*  Reads an analog input from the input pin and sends the value 
*  followed by a line break over the serial port. 
*  This file is part of the Arduino meets Processing Project:
*  For more information visit
*  copyleft 2005 by Melvin Ochsmann for Malm? University

// variables for input pin and control LED
  int analogInput = 3;
  int LEDpin = 13;
// variable to store the value 
  int value = 0;
// a threshold to decide when the LED turns on
  int threshold = 512;
void setup(){

// declaration of pin modes
  pinMode(analogInput, INPUT);
  pinMode(LEDpin, OUTPUT);
// begin sending over serial port

void loop(){
// read the value on analog input
  value = analogRead(analogInput);

// if value greater than threshold turn on LED
if (value < threshold) digitalWrite(LEDpin, HIGH); else digitalWrite(LEDpin, LOW);

// print out value over the serial port

// and a signal that serves as seperator between two values 

// wait for a bit to not overload the port

I glommed it from

The code fragment:


caused it to throw an obvious exception,
“ap_ReadAnalog.cpp: In function ‘void setup()’:
ap_ReadAnalog:30: error: ‘beginSerial’ was not declared in this scope
ap_ReadAnalog.cpp: In function ‘void loop()’:
ap_ReadAnalog:41: error: ‘printInteger’ was not declared in this scope
ap_ReadAnalog:44: error: ‘printByte’ was not declared in this scope”

I confess I don’t know really know what it means. here. It may have worked for the release available in 2005, but definitely not for 0022…

Suggestions please

Doctor Who8
Be careful of things that go BLEEP!

The command should be:-


Thank you Mike. That solved on problem. I suspect since I’ve been out of the loop with regards to the Arduino, it should be obvious, but this one doesn’t seem to be tagging anything as such:


And of course its error routines that it causes:
“ap_ReadAnalog.cpp: In function ‘void loop()’:
ap_ReadAnalog:41: error: ‘printInteger’ was not declared in this scope
ap_ReadAnalog:44: error: ‘printByte’ was not declared in this scope”.

I suspect that by turning it around, it would be


But that is where I’m not so sure.

Doctor Who8
The only thing that time causes is itself.

You seem to have code that is expecting another library to be installed. Look at the language reference under the help menu. In the normal arduino there is no such thing as printInteger(value); you just use Serial.print(value); Or Serial.print(value, DEC); or Serial.println(value); // for a new line after the print.

Hello! I quite agree. And while your suggestions do make plenty of sense (Here it is just approaching 7AM, and a new rather hot and hazy summer style day is starting.)

I've begun to realize that if this whole idea is to work, it would require a near or total rewrite of the Malmo code to work properly now.

And that's only the regular Arduino code to to consider. They also posted a raw Processing blob that I've yet to consider.

This whole entire idea is yet another attempt of mine to consider an application for the Pachube to, ah, process and then respond to. I tried to get everything to work, about, two years previously. It didn't want to work then.

I'll have more luck when their entire site is available.

Doctor Who8