TImedAction or NewSoftSerial ?? Touchshield Slide Won´t Compile

Hi Team
I have a work-in-progress to Kurt´s Scooterputer with some early progress - writing a line at a time and checking Compile- that´s where my coding experience is at.
The TouchShield code is all good; Analogue style gauges - took me a wee while to figure that the trig funcs operate on Radians! Should have RTFM.

But I just ‘copy and pasted’ Kurt´s Slide update routines into my code on the arduino end of the Arduino - Slide pair. In his original, in the same IDE with the same libraries (both included and present in the libraires’ loactions) Kurt´s compiles with a completed Build report.

I have done one thing to his code and that is change his references to TEMP (temperature with DallasTemeperature library and DS18B20) eg. to OilTemp (cos late i want Spark Plug Temperature with a thermocouple):
With big contributions from Scooterputer by Kurt Schulz Apr2010
and rpm (Tachometer) from the playground

pertinent bits of my code:

Take 1: roadWheel on A0. roadSpeed maths.
Take 2: TouchShield Slide. chang TEMP_ PIN etc to OilTemp_PIN et al
prefix m:     moderated:  after assimilate, mediate, equalise, map, smooth and or range to prepare for real Use
suffix Prev:  Previous:   prepare for next iteration, update last value with current, call it Previous.
tick:                     unit associated with toggle of input, from H to L, 0 to 1, L to H, 1 to 0, ON to OFF it maybe
                          that a tick is change from one state to its alternate and them not the reciprocal, as
                          appropriate, but following the reciprocal, from the one state to its alternate IS another tick.


#include <NewSoftSerial.h>          //effect serial port in software
#include <TimedAction.h>            //Provide facility for repeated, regular functions
#include <DallasTemperature.h>      //DS18B20 temp sensor
#include <OneWire.h>                //bus interface temp sensors
#include <Wire.h>                   //I2C interface

  //Digital Pins
//#define programming  0            // USB slave programming
//#define pragramming  1            // USB slave programming
#define TS_TX_PIN      2            // TouchShield serial transmit data
#define TS_RX_PIN      3            // TouchShield serial receive data
#define GPS_RX_PIN     4            // GPS serial RXd, Garmin GPS15 NMEA
#define GPS_TX_PIN     5            // GPS serial TXd, Garmin GPS15 NMEA
#define OilTemp_PIN    6            // Temperature sensor DS18B20
#define TACH_PIN       7            // Ignition Pulses

  //Analog Pins
#define ACCEL_X_PIN    0            // Accelerometer ADXL-320 X axis
#define ACCEL_Y_PIN    1            // Accelerometer ADXL-320 Y axis
#define roadWheel_PIN  2            // roadWheel photodiode
#define batCurrent_PIN 3            // Battery Current ACS712
//#define RTC_SCL      4            // now using RTC within GPS

  //Simple Serial protocol commands
#define STX            0x02         //Start of Text
#define ETX            0x03         //End of Text
#define CR             0x0D         //Carriage Return
#define CTRL_Z         0x1A         //Control-Z

  //Tasks - periodic functions by TimedAction
TimedAction OilTemp_UpdateTask = TimedAction( 10000, OilTemp_Update );
TimedAction TS_SendDataPacketTask = TimedAction( 250, TS_SendDataPacket );
TimedAction TS_ReceiveDataPacketTask = TimedAction( 1000, TS_ReceiveDataPacket );

NewSoftSerial TS_Serial = NewSoftSerial( TS_RX_PIN, TS_TX_PIN );  
OneWire oneWire( OilTemp_PIN );
DallasTemperature OilTemp_Sensor( &oneWire );
OneWire oneWire( OilTemp_PIN );
DallasTemperature OilTemp_Sensor( &oneWire ); 

  //Sensor initalisers
int valroadWheelPin = 0;              // roadWheel revolutions photodiode 0 to 1023
long valODO         = 0L;             // Odometer kilometres 0 to 999,999 kilometres
int valTripA        = 0;              // Trip A km, internal: 0 to 999
int valTripB        = 0;              // Trip B km, (FUEL) internal: 0 to 999
int valGPSPulse     = 0;              // GPS good NMEA sentence, binary
int valSpareInt     = 0;              // Spare integer value
int valTODHH        = 0;              // Time Of Day (TOD) hours, RTC: 1-12
int valTODMM        = 0;              // TOD minutes, RTC: 0-59
int valDateMonth    = 0;              // Current date month, RTC: 1-12
int valDateDay      = 0;              // Current date day, RTC: 1-31
int valDateYear     = 0;              // Current date year, RTC: 0-99
int valTemp         = 0;              // Temperature, TEMP: -50 to 150 (ºC)
int valACS          = 0;              // Allegro Current Sensor 2.5-4.5Volts at the pin
int valIncline      = 0;              // Incline angle, ACCEL: -90 to 90 (º)
long valHeading     = 0L;             // Heading, GPS: 0-360 (º) 
int valLatDegrs     = 0;              // Latitude º, GPS: 
long valLatFrac     = 0L;             // Latitude fraction, GPS:
int valLatNS        = 0;              // Latitude NS, GPS: N = 0, S = 1
int valLonDegrs     = 0;              // Longitude º, GPS:
long valLonFrac     = 0L;             // Longitude fraction, GPS:
int valLonEW        = 2;              // Longitude EW, GPS: E = 2, W = 3
float valWheelCrcmfrnc =1.830;           // Actual road going external circumfernce of tyre, metres

//roadWheelRPM and hence Speed
int mroadWheel      = LOW;            //glossary prefix m, moderated
int mroadWheelPrev;                   //glossary Previous  
int count           = 0;
int roadWheelSens   = 75;             //threshold on ADC value for toggle (of Photodiode logic state) 
int nPulsPerRev     = 2;              //number of ticks per revolution
int millisecs       = 500;            //time between samples
int roadWheelRPM;
int valKMH;

long roadWheelInterval = 0;

void setup()
  TS_Serial.begin(19200);                 //Start Touchshield interface
  OilTemp_Sensor.begin( );                //Start oil temperature interface
//  Wire.begin();                         //RTC, not used, now use RTC in Garmin GPS15
  OilTemp_Update( );                      // Get initial oil temperature
  OilTemp_UpdateTask.enable( );           // Enable task for reading the temperature
  TS_SendDataPacketTask.enable( );        // Enable task for sending packets to the TouchShield
  TS_ReceiveDataPacketTask.enable( );     // Enable task for receiving packets from the TouchShield
  pinMode(13,OUTPUT);           //Annunciator (for mTach and... )
void loop()
//roadWheel RPM
//Designed for photodiode - analogue forward voltage dependent on incident (IR) light.
//TODO: change for other technology of rev sensor (hall effect?). IR too variable with bright sunlight.

//for forum section removed
//Oil Temperature by DS18D20

// Serial data transfer to the TouchShield display
// Timed Action
void TS_SendDataPacket( );
  TS_Serial.print( STX, BYTE );
  TS_WriteInt( valKMH );
/*  TS_WriteLong( valODO );
  TS_WriteInt( valTripA );
  TS_WriteInt( valTripB );

  TS_WriteInt( valGPSPulse );
  TS_WriteInt( valSpareInt );
  TS_WriteInt( valTODHH );
  TS_WriteInt( valTODMM );
  TS_WriteInt( valDateMonth );
  TS_WriteInt( valDateDay );
  TS_WriteInt( valDateYear );
  TS_WriteInt( valTemp );
  TS_WriteInt( valBatt );
//  TS_WriteInt( valIncline );
//  TS_WriteLong( valHeading );
//  TS_WriteInt( valLatDegrs );
//  TS_WriteLong( valLatFrac );
//  TS_WriteInt( valLatNS );
//  TS_WriteInt( valLonDegrs );
//  TS_WriteLong( valLonFrac );
//  TS_WriteInt( valLonEW );
  TS_Serial.print( ETX, BYTE );
void TS_WriteInt( int value )
  // Write high byte, low byte
  TS_Serial.print( ( unsigned char )( value >> 8 ) );
  TS_Serial.print( ( unsigned char )value ); 

void TS_WriteLong( long value )
  // Write high word, low word
  TS_WriteInt( ( unsigned int )( value >> 16 ) );
  TS_WriteInt( ( unsigned int )value ); 

// Handy for debugging communications with TouchShield
int whirlyGig = 0;
void TS_WriteWhirlyGig( )
  char* whirlyGigs[] = { "|", "/", "-", "\\", "|", "/", "-", "\\" };

  TS_Serial.print( whirlyGigs[ whirlyGig ] );
  whirlyGig = ( ++whirlyGig > 7 ) ? 0 : whirlyGig;

I´ve done what i can to look in the libraries for the problem, I can paste Kurt´s bits directly into my code with my OilTemp… bits commented out and then his doesn´t compile either… but the libraries are the same (i think - if they´re not then i don´t know how not).

Can anyone suggets where i look next. All suggestions and guidance gratefully recieved.

For your amusement here´s what i have done so far for the TouchShield . . .i intend to make it wireless including power… with a bettery in the TS box and a two part transformer based on the principles used by electric toothbrushes so i can lift the Slidebox off the bike without unplugging and no contacts to rust like the TomTom Rider GPS . .


Mod edit: Posted code in code box. AWOL


PLease modify your code, select the code and press the # button so the code is tagged appropiately. Keeps the stuff readable :)

Thing I noticed is taht you have a double initialization. OneWire oneWire( OilTemp_PIN ); DallasTemperature OilTemp_Sensor( &oneWire ); OneWire oneWire( OilTemp_PIN ); DallasTemperature OilTemp_Sensor( &oneWire );

Can you post the error messages from the compiler? (as I not have all those libs installed)

Thanks Rob i can do those still for interest but i found the problems all in Cirly Brackets - missing, wrong and extras!!! There is code to do Tachometer from a digital pin further down that i had not included in the post cos i thought it irrelevant. It was a paste from a complete good sketch so i didn´t doubt it.

And of course i´ve learnt a lot by methodically working out what where why when and how!!!

Many thanks.

An "off topic" if anyone reads this far -

All reed switches which are wetted contact (sp. whetted??) do not Bouce and so do not need de-bouncing. The wetted refers to mercury dipped and so they benefit from the surface tension of liquid mercury to "snap" the contacts open and closed. I guess if you find RoHS reed switches maybe they bounce as they lack the mercury. And i don´t know if All reed switches are mercury wetted . . .

Will this work on a LCD other than a Touchshield slide? I have a adafruit 2.8 tftlcd. Where do you get the other library files from?