Show Posts
Pages: [1]
1  Development / Other Software Development / Re: Sharp IR Sensors Library on: March 13, 2014, 09:52:30 am
Mike,
thanks for the suggestions.
while checking my code I found that I set the model to 20150 in my code when I was using a 1080 sensor.
I change my code to set the model to 1080 and now it reports correctly. Same distance values as the ping within 1cm.

2  Development / Other Software Development / Re: Sharp IR Sensors Library on: February 16, 2014, 04:35:13 pm
Hi, I re-read your cpp and example sketches and am now using model 1080 for my SHARP GP2Y0A21YK0F a 10-80cm ir sensor.

I am also running a parallax ping sensor. mounted at the same distance to the wall as the Sharp IR sensor.

It appears that the parallax ping sensor is reporting (within 1 cm) the actual distance in cms and the Sharp IR sensor using your example code is reporting roughly twice the distance in cm.

I measured with a metric ruler the distance from both the ping and sharp sensors at 15 cm
Ping reports 16 cm, the sharp ir sensor reports 35 cm

Any ideas as to why the large difference?

Thanks



3  Development / Other Software Development / Re: Sharp IR Sensors Library on: February 15, 2014, 05:06:14 pm
Hi, I have a Sharp GP2Y0A21YK0F infrared distance measuring sensor
Can you suggest what I can do to add this model to your library?
 I am not sure what to look at on its data sheet to get the values.

Thanks
4  Development / Other Software Development / New 1.0.2 IDE For Arduino Mega, having avrdude use "wiring" not "stk500v2" on: November 16, 2012, 04:17:29 pm
Hi, anybody know if the new 1.0.2 IDE hardware fix for the 2560 MEGA to use the wiring option instead of the stk500v2 bootloader affects the Megas issues with using the watchdog timer? See issue 181

Thanks

5  Using Arduino / Displays / Re: MENWIZ: yet another character lcd menu wizard library on: September 05, 2012, 02:26:12 pm
I'm happy it works. It was in my goals to write a library simple to use and hackable.
And now let me try to hel paco :-)


p.s. please send to me the modified files and sketch. I want let it available on github

Hi, I will send you the modified libs, how do I send them to you? I am new to these message forums and not sure how to send them to you. The zipped files are to big to attach, about 9KB

Question
I have been testing your Test_all_var_types example and all is working well with the exception of getting the current value of the tp selection list. The menu remembers that I last selected list item 4 or 5, but when I try to print it to the serial monitor when the Write To serial  menu item is selected and confirmed, tp aways prints as 0, all the other non list variables like the float, byte, boolean, and int show the last selected value but not the list number selected.

Any ideas what I should do to see the currently selected List item number?

Thanks
Tom
6  Using Arduino / Displays / Re: MENWIZ: yet another character lcd menu wizard library on: August 26, 2012, 07:39:39 am
Update on using Menwiz library with the LCDI2cw library.

It Works.
2 edits to menwiz.h, 5 edits to menwiz.cpp and it works Great.
I have successfully run the menwiz example sketch Test_all_var_types using the standard 6 button menu.navButtons method.

Menwiz is a powerful, flexible, easy to use library. Many thanks to the author for writing it and especially for his help in identifying the needed code changes to work with a different LCD I2C library other than LiquidCrystal_I2C.

Tom
7  Using Arduino / Displays / Re: MENWIZ: yet another character lcd menu wizard library on: August 25, 2012, 03:12:26 pm
Thank you Bruno,

Sorry for not posting the code correctly, I will remember for next time.

The test sketch now compiles, I had to change a line in Menuwiz.cpp in the begin routine to say:
lcd=(LCDI2Cw*)1; rather than lcd=(LCD*)1;

I will test the code tonight and let you know how well it works.

Thanks again for your help.

Tom
8  Using Arduino / Displays / Re: MENWIZ: yet another character lcd menu wizard library on: August 25, 2012, 01:50:53 pm
Hi Bruno, thanks for your reply.

It looks like the LCDI2C2 lib differs from the Liquidcrystal_I2c lib only in the begin and setBacklight and contrast routines

Here is my changes to your Test_all_variables example that I tried to use the LCDI2C2w lib

//MENWIZ ESAMPLE
#include <Wire.h>
#include <LCDI2Cw.h>

//INSERT ALL THE FOLLOWING 5 INCLUDES AFTER INCLUDING WIRE LIB
//#include <LCD.h>
//#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>
//#include <EEPROM.h>    // to be included only if defined EEPROM_SUPPORT



// DEFINE ARDUINO PINS FOR THE NAVIGATION BUTTONS
#define UP_BUTTON_PIN       9
#define DOWN_BUTTON_PIN     10
#define LEFT_BUTTON_PIN     7
#define RIGHT_BUTTON_PIN    8
#define CONFIRM_BUTTON_PIN  12
#define ESCAPE_BUTTON_PIN   11

//Create global object menu and lcd
menwiz menu;
//LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity

unsigned char i2cAddress = 0x4C;  // LCD module I2C address
const int myrows = 2;
const int mycols = 16;
// initialize the library with the number of columns and rows
LCDI2Cw lcd(mycols, myrows, i2cAddress);

//instantiate global variables to bind to menu
int      tp=0;
float    f=26.0;
boolean  bb=0;
byte     b=50;

void setup(){
  _menu *r,*s1,*s2;
  _var *v;
  int  mem;

  Serial.begin(9600); 
 
  // have a look on memory before menu creation
  Serial.println(sizeof(menwiz));
  mem=menu.freeRam();
 
  // inizialize the menu object (20 colums x 4 rows)
  menu.begin(&lcd,mycols,myrows);

Here are my changes to Menuwiz.h
#ifndef MENWIZ_h
  #define MENWIZ_h

//#define EEPROM_SUPPORT     //uncomment if you want to use the readEeprom and writeEeprom methods!

#include <Wire.h>

//#include <LCD.h>
//#include <LiquidCrystal_I2C.h>

#include <buttons.h>

Here are my changes to Menuwiz.cpp
void menwiz::begin(void *l,int c, int r){

  ERROR(0);
  tm_start=millis();
  row=r;
  col=c;
  flags=0;
  lcd=(LCD*)l;

  // for liquidcrystal_i2c
  //lcd->begin(c,r);  //  LCD size
  //lcd->setBacklight(HIGH);
  // end for liquidcrystal_i2c

  //  for LCDI2Cw         // gives error: MENWIZ.h:196: error: ISO C++ forbids declaration of 'LCD' with no type
  lcd->begin();
  lcd->backlight(200);
  lcd->contrast(50);
  // end for  LCDI2Cw

  // for both
  lcd->noCursor();
  lcd->createChar(0,(uint8_t*)c0);
  // end for both

  sbuf=(char*)malloc(r*c+r); if(sbuf==NULL) ERROR(900);
  buf =(char*)malloc(2*c);   if(buf==NULL) ERROR(900);
  }

With these changes i get the following compile time errors:
E:\arduino-1.0.1\libraries\MENWIZ/MENWIZ.h:198: error: ISO C++ forbids declaration of 'LCD' with no type
E:\arduino-1.0.1\libraries\MENWIZ/MENWIZ.h:198: error: expected ';' before '*' token

The LCDI2cw lib backlight routine takes a value from 0 to 255
The LCDI2Cw lib contrast routine takes a value from 0 to 100
and the LCDI2Cw lib begin routine takes no parameters and only issues a Wire.begin() command and a lcd.clear command.

Can you suggest what I can try to clear the forbids declaration of 'LCD' with no type  error?

I can email you the LCDI2Cw library files if you would like. I just need your email or another way to send you the files.

I have many sketches that use this LCDI2Cw lib and would like to continue to use it with your menu system.

Thanks

Tom

9  Using Arduino / Displays / Re: MENWIZ: yet another character lcd menu wizard library on: August 25, 2012, 09:23:25 am
Hi Bruno, recently found your menuwiz library, Its powerful, flexible, simple to use, and best of all is runs asyncronously letting other pgm code run.

I plan to use it with an i2C LCD display that has button inputs, it comes with its own LCD_I2C front end interface to the WIRE lib. Its called LCDI2Cw lib from web4robot.  The lcd display uses a Hitachi HD44780 chipset.  It has the following functions:
// available functions
/********************************************
  void clear();
  void home();                            // set cursor to row 0, col 0

  void noDisplay();
  void display();
  void noBlink();
  void blink();
  void noCursor();
  void cursor();
  void cursorLeft();
  void cursorRight();   
  void scrollDisplayLeft();
  void scrollDisplayRight();
  void createChar(uint8_t, uint8_t[]);
  void setCursor(uint8_t, uint8_t);         // col, row, rows 0 to 3, column 0 to 19
 
  unsigned int firmware();
  void keypadMode(uint8_t mode);            // 0 = 4x4 butron matrix, 1 = 8 separate buttons, default is 0
  unsigned int keypad ();
  unsigned int remoteCtr ();
  void backlight(uint8_t light);            // 0 to 250, default is 70
  void contrast(uint8_t contrast);          // 0 to 100, default is 20
********************************************/

Can I replace the following includes in your example pgms to this to use this i2clcd lib?
#include <Wire.h>
#include <LCDI2Cw.h>
#include <MENUWIZ.h>

unsigned char i2cAddress = 0x4C;  // LCD module I2C address
const int myrows = 4;
const int mycols = 20;
LCDI2Cw lcd(mycols, myrows, i2cAddress);  // this lcd object is used my menuwiz

Questions:
1. Will I need to modify your MENUWIZ.h and cpp files to use my LCDI2Cw lib and remove references to LiquidCrytsal and buttons?

2. I also plan to add my own button handler (addUsrNav(navMenu), my question is where to I put my code to read the buttons so the button handler called from the menu.draw() function can process my button presses. It looks like I should add a call to my readButtons() function in the main loop just after the call to menu.draw().

Is this correct?

Thanks

Tom




10  Using Arduino / Sensors / Re: 20ma current loop interface question on: May 18, 2012, 07:46:27 pm
Thanks Chagrin, I will look into using SoftwareSerial. My Sensor interface to the Arduino is only 2 bits so I have attempted to design a 2 bit digital interface with RS485 chips. The sensor output is a latched logic high or low from a 555 timer. The sensor has a reset circuit that when it receives a low pulse it will resets the 555 output to a low. I took a shot at designing a rs485 interface using 3 digital output pins and 1 digital input pin. The arduino will set one 485 chip into transmit mode and send either a low or a high pulse to a remote 485 receiver. The receiver will send its RO output to the /RE and DE lines of another 485 chip. This will either enable its DI input or its RO output. The DI input will send the logic state of the latched 555 timer back to another 485 chip near the arduino so the arduino can test if the latch is set or clear and then do something like write a message to the serial lcd display. The RO output will drive a mosfet in effect simulating a switch being closed to ground to be used to reset the latched 555 timer back to a logic low state.
I am attaching a schematic that I think may work. I would greatly appreciate all comments on whether or not my schemtaic will accomplish my goal which is: Remotely read the state of a switch( the latched 555 output) and then remotely reset the switch back to a known logic state.

11  Using Arduino / Sensors / Re: 20ma current loop interface question on: May 18, 2012, 06:55:27 am
Can I read a single bit into a digital input pin if I supply a clock pulse from a digital output pin?
The Tx and Rx lines on my arduino uno are already in use driving a 16x2 serial lcd.
Would I need a current limiting resistor from the digital output pins and or digital input pins to drive the rs485 input and clock pins?
Thanks
12  Using Arduino / Sensors / 20ma current loop interface question on: May 17, 2012, 04:39:54 pm
Hi, has anyone successfully interface an optoisolator and and 20ma current loop to the arduino digital output and digital input pins?

I have a Vibration sensor located about 100 feet from where the arduino will be.
The sensor has its own power supply (9v battery). I want to keep the sensors power and ground isolated from the arduino power and ground (9v wall wart). Given the distance I think I want to use a 20ma current loop over a shielded twisted pair to read a signal from the sensor and to send a Reset signal to the sensor. I want to read the sensor say every second and Reset it whenever appropriate. Reset would drive digital output pin High for x milliseconds then drive it low and keep it low until next reset time. A High on the digital input pin would indicate a certain level of vibration (think very loud knock) was picked up. The Arduino would poll the input pin and when it sees a High on it, it would send a Reset signal to the sensor and then run code to process that a knock has been heard. When done processing the knock it would start listening for future knocks.

I found a chip set called HCPL4100 and HC4200 that looks like it will do the job.
Not sure if I need a resistor from the arduinos digital output and digital input pins to the TTL out and TTL in pins on the respective chips.

This is my first arduino project and I do not want to burn up the arduino if I connect it wrong.

Anybody have any suggestions?
Thanks
Pages: [1]