Well I'm new to c++ but have been coding in flash and vb6 for a year or too. I'm having problems with int / char / strings etc. The code I'm using is below.. I know its a bit messy but I'm learning as I go. What would be really hand would be a brief example of how to convert between the two.. in vb6 all it would be is str(variable) or int(variable) anything similar ?
#include <LCD4Bit_mod.h>
LCD4Bit_mod lcd = LCD4Bit_mod(2);
int inPin = 2; // choose the input pin (for pulse count)
volatile long count = 0;
long currentmils = 0; // variable to hold current mills value
int currentspeed = 0; // holds current speed value (needs to be calibrated)
long currentdelay = 0;
int ledPin = 13; // LED connected to digital pin 13
int ledval = 0;
int batwings = 0;
void setup() {
pinMode(inPin, INPUT); // declare pushbutton as input
currentmils = millis(); // set current millis
Serial.begin(9600); // using serial output so I can monitor whats going on.
pinMode(ledPin, OUTPUT); // sets the digital pin as output
attachInterrupt(0, pulse, FALLING);
lcd.init();
lcd.clear();
}
void loop(){
if ((currentdelay + 100) < millis()) { // runs every second, will shortern time once calibrated
currentdelay = millis();
if (currentspeed > 50) {batwings = 1;}
if (currentspeed < 30) {batwings = 0;}
lcd.cursorTo(1, 0);
lcd.printIn(currentspeed);
lcd.cursorTo(2, 0);
if (batwings == 0 ) {
lcd.printIn("Bat Wings - down");
} else {
lcd.printIn("Bat Wings - up ");
}
//Serial.print(currentspeed);
//Serial.print(" ");
if (ledval == 0 ) {
digitalWrite(ledPin, HIGH);
ledval = 1;
} else {
digitalWrite(ledPin, LOW);
ledval = 0;
}
}
}
void pulse()
{
currentspeed = 1000 / (millis() - currentmils);
currentmils = millis();
}