DFRobot Shield library for LCD Keypad Shield from DX

If you have ordered “LCD Keypad Shield for Arduino Duemilanove & LCD 1602” from DealExtreme and are wondering about how to get this thing working without datasheet, you are in the right place :-)

This product seems to be very similar(!) a product called “DFRobot LCD Keypad Shield for Arduino” and the Datasheet and even a library (LCD4bit_mod) for easy programming of it is available at following link, http://www.robotshop.com/dfrobot-lcd-keypad-shield-arduino.html, under useful links.

The only issue with the library is that this is built for old versions of Arduino and if one to make it work with newest version (Arduino 1.0), then some parts of the code should change. First you need to install the additional library in your Arduino on your computer (by copying the content of the zip file in the “libraries” folder of Arduino program). Afterwards one should change the content of LCD4bit_mod.cpp 

Continue reading

String to Double issues in C# .NET

If you are simply using

double test = Double.Parse(“12.45″);

and it doesn’t work due to formating issues, here is the right post for you. Almost certainly you’re using the wrong CultureInfo. Try specifying CultureInfo.InvariantCulture to parse in. I suspect it’s currently assuming that “.” is a thousands separator rather than a decimal point.

CultureInfo Invc = new CultureInfo(“”);
Invc = CultureInfo.InvariantCulture;
x1 = Double.Parse(“12.45″, Invc);

alternative:

x1 = Double.Parse(“12.45″, CultureInfo.InvariantCulture);

Reading input from ABB flexpendant

On ABB robots, one have access to a syntax in RAPID programming language called TPRead. TPRead allows the programmer to read live values from the user (operator) while your code is being run.

TPReadNum reg1,”Text”;

Code Example:
PROC readJNumFromPendant()
TPErase;
TPReadNum reg1,”Enter Input Number?”;
readValue := reg1;
TPWrite “Read Value is: ” + ValToStr(testRead);
ENDPROC

RAPID_refer4.0

Tab Order in C# Windows Form – MS Visual Studio 2010

Setting Tab order in C# (Visual Studio 2010):

1 – Select View – Tab Order. This activates the tab-order selection mode on the form. A number (representing the TabIndex property) appears in the upper-left corner of each control.

2-  Click the controls sequentially to establish the tab order you want.

3 – When you are done, click View – Tab Order to deactivate the indexing.

Source: http://msdn.microsoft.com/en-us/library/bd16a8cw.aspx

Flame Detector Sensor, Arduino | – Programming Tutorial

This is a sample code to show how this cheap component from DealExtreme works with Ardunio (2.5$ with free shipping). These are very useful sensors for building [b]firefighting robots[/b] :D Look at the sample code for more info.

Sensor detecting match flame

Sensor detecting match flame

purchase link:

http://www.dealextreme.com/p/arduino-flame-sensor-for-temperature-detection-blue-dc-3-3-5v-118075

Continue reading

Quality Joystick from DealExtreme (very cheap) | – Programming Tutorial

Here I am about to write a tutorial about a cheap joystick I came across lately which can be bought for only 3.5$ with free shipping to Norway. It is a PS2 repair kit which can easily be used with Arduino concept as well (the input voltage is 5+). It can detect all 8 directions in 2D dimension and also Clicked feature.

Joystick tutorial

Joystick tutorial

Purchase link:

http://www.dealextreme.com/p/repair-parts-replacement-analog-stick-module-for-ps2-controller-black-121340

Here the outputs from the joystick are only VRx, VRy, SW, GND and +5V.
VRx = x value (see program)
VRy = y value (see program)
SW = if Clicked or Not -> Clicked = 0, NOT clicked = 1

———————–
[code lang="arduino"]
/*
JOYSTICK Program connected to Arduino

http://www.dealextreme.com/p/repair-parts-replacement-analog-stick-module-for-ps2-controller-black-121340

Developer:
Akbar (Shahab) F. Moghaddam
20.05.12

Comment : Front, Back, left, right
*/

//CONSTANTS
const int pinX = 2;
const int pinY = 1;
const int pinSW = 0;

//VARIABLE
int VRx = -999;
int VRy = -999;
int SW = -999;
int readVal = 0;
boolean logging = false;

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
pinMode(0, INPUT);
pinMode(1, INPUT);
pinMode(2, INPUT);
Serial.begin(19200);
}

void loop() {
initialAll();
readValues();
loggingProcess();
printState();
delay(1000);// wait for a second
}

void initialAll(){
readVal = 0;
}

void readValues(){
VRx = analogRead(pinX);
VRy = analogRead(pinY);
SW = analogRead(pinSW);
if (Serial.available()>0){
readVal = Serial.read();
}
}

void loggingProcess(){
if (readVal == 'l'){
if (logging)
logging = false;
else
logging = true;
}

if (logging){
Serial.println("------------");
Serial.println("SYUMMARY");
Serial.print("X:");
Serial.println(VRx);
Serial.print("Y:");
Serial.println(VRy);
Serial.print("SW is:");
Serial.println(SW);
Serial.println("------------");
}
}

void printState(){
if (SW == 0){
Serial.println("------------");
Serial.println("CLICKED");
Serial.println("------------");
}
else if (VRx > 330 && VRx < 350 && VRy > 325 && VRy < 350){
Serial.println("------------");
Serial.println("NORMAL");
Serial.println("------------");
}//NORMAL
else if (VRx > 660 && VRx < 700 && VRy > 325 && VRy < 350){
Serial.println("------------");
Serial.println("FRONT");
Serial.println("------------");
}//FRONT
else if (VRx < 5/*==0*/ && VRy > 325 && VRy < 350){
Serial.println("------------");
Serial.println("BACK");
Serial.println("------------");
}//BACK
else if (VRx > 330 && VRx < 350 && VRy < 5 /*==0*/){
Serial.println("------------");
Serial.println("LEFT");
Serial.println("------------");
}//LEFT
else if (VRx > 330 && VRx < 350 && VRy > 665 && VRy < 700){
Serial.println("------------");
Serial.println("RIGHT");
Serial.println("------------");
}//RIGHT
else if (VRx > 350 && VRx < 680 && VRy > 350 && VRy < 670){
Serial.println("------------");
Serial.println("FRONT-RIGHT");
Serial.println("------------");
}//FRONT-RIGHT
else if (VRx >= 0 && VRx < 350 && VRy > 350 && VRy < 680){
Serial.println("------------");
Serial.println("BACK-RIGHT");
Serial.println("------------");
}//BACK-RIGHT
else if (VRx >= 0 && VRx < 330 && VRy >= 0 && VRy < 325){
Serial.println("------------");
Serial.println("BACK-LEFT");
Serial.println("------------");
}//BACK-LEFT
else if (VRx > 350 && VRx < 680 && VRy >= 0 && VRy < 325){
Serial.println("------------");
Serial.println("FRONT-LEFT");
Serial.println("------------");
}//FRONT-LEFT
else{
Serial.println("------------");
Serial.println("UNKNOWN");
Serial.println("------------");
}//UNKNOWN
}
[/code]

Arduino Code Syntax Highlighting Plugin for your WordPress Blog

Source : http://elabz.com/arduino-syntaxhighlighter/
INSTALLATION INSTRUCTIONS

1 – Install SyntaxHighlighter Evolved plugin in your wordpress.
2 – Unzip content of the Arduino Brush archive into a temporary directory, then upload content of that directory (syntaxhighlighter-arduino) to your WordPress plugins folder (usually wp-content/plugins/).
3 – Open Plugins in your WordPress Dashboard and activate both ‘SyntaxHighlighter Evolved’ and ‘SyntaxHighlighter Evolved: Arduino Brush’ plugins
4 – Go to the main plugin’s ‘SyntaxHighlighter Evolved’ Settings and in the “Color Theme” Select “Arduino”. No other changes from defaults are necessary. Save the new settings.

USAGE:
- Use only in HTML mode of the WordPress Editor
- Place Arduino code to highlight between:

* Prefer without line numbers:

EXAMPLE:

[code lang="arduino"]
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
[/code]

source : http://elabz.com/arduino-syntaxhighlighter/