Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Interfacing / Re: 7 Segment Display with NewSoftSerial on: August 16, 2010, 03:03:42 pm
Thanks a lot tkbyd !

My code is now :
Code:
// library
#include <SoftwareSerial.h>

// Pin for 7 segment display
#define rxPin 2
#define txPin 3
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);


void setup()  {
  // set up Serial library at 9600 bps for debug
  Serial.begin(9600);          
  
  Serial.println("Ethylometre v0.01");
 
  Serial.println("Set pin mode");  
  // define pin modes for tx, rx, led pins:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);

  Serial.println("Set data rate for the SoftwareSerial port");
  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  //v=0x76. To reset display module
  mySerial.print("vv");
}

void loop() {
  
  Serial.println("# START Loop");
  
  delay(1000);
  displaySeg(1);
  delay(1000);
  displaySeg(12);  
  delay(1000);
  displaySeg(123);
  delay(1000);
  displaySeg(1234);
  delay(1000);

 Serial.println("# END Loop");
}

void displaySeg(int mg) {;
  
  if(mg < 10) {
    mySerial.print("   ");
    mySerial.print(mg);
  } else if(mg < 100) {
    mySerial.print("  ");
    mySerial.print(mg);
  } else if(mg < 1000) {
    mySerial.print(" ");
    mySerial.print(mg);
  } else if(mg < 1000) {
    mySerial.print(" ");
    mySerial.print(mg);
  } else {
    mySerial.print(mg);
  }
}
2  Forum 2005-2010 (read only) / Interfacing / Re: 7 Segment Display with NewSoftSerial on: August 16, 2010, 01:39:32 pm
Hi,

I have this 7 segment Display and i use serial port to display data. I use the following code :
Code:
#include <SoftwareSerial.h>

#define rxPin 2
#define txPin 3
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

void setup()  {
  
  // define pin modes for tx, rx, led pins:
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
  
  //set the data rate on 7 segment 0x02 = 9600bps
  delay(100);
  mySerial.print(0x79);
  delay(100);
  mySerial.print(0x02);
  
  // set brightness brighter
  delay(100);
  mySerial.print(0x7A);
  delay(100);
  mySerial.print(0x00);
  
  
}
void loop() {

  delay(2000);
  mySerial.print(0x01);
  mySerial.print(0x06);
  mySerial.print(0x06);
  mySerial.print(0x04);
  
    delay(2000);
  mySerial.print(0x01);
  mySerial.print(0x04);
  mySerial.print(0x09);
  mySerial.print(0x06);

  
  delay(2000);
  mySerial.print(0x01);
  mySerial.print(0x09);
  mySerial.print(0x08);
  mySerial.print(0x08);
}


Sometimes, the 7 segment don't display this :
Quote
1664
1496
1988

BUT this :
Quote
6641
4961
9881

There is an offset.. How correct this ? I search a special Commands in datasheet, but i found nothing..

Any help would be appreciate :-)
3  Forum 2005-2010 (read only) / Interfacing / Re: 7 Segment Display using SPI on: June 20, 2010, 02:48:30 pm
How to do with "OneWire" ? SPI needs 4 wires when you have 1 master and 1 slave..  
4  Forum 2005-2010 (read only) / Interfacing / Re: 7 Segment Display using SPI on: June 20, 2010, 09:49:13 am
Thanks a lot !
5  Forum 2005-2010 (read only) / Interfacing / Re: 7 Segment Display using SPI on: June 19, 2010, 04:15:51 pm
Up ^^
6  Forum 2005-2010 (read only) / Interfacing / Re: 7 Segment Display using SPI on: June 16, 2010, 03:33:29 pm
Hi every body,

I'm new with arduino. I tried to display "1234" with serial like this :
Code:
RX      ->  PIN TX  
 VCC   ->  PIN  3.3V
 GND   ->  PIN GND


Code:
void setup(){
  Serial.begin(9600);
  delay(100);
  Serial.println(0x79);
  delay(100);
  Serial.println(0x02);
}
void loop() {
 delay(1000);
 Serial.println(1,BIN);
 Serial.println(2,BIN);
 Serial.println(3,BIN);
 Serial.println(4,BIN);
}

It display lot of thing but but "1234" !

I writed this dirty code from the documentation on sparkfun website.
7  Forum 2005-2010 (read only) / Interfacing / Re: An other PS2 keyboard problem on: August 22, 2010, 01:27:01 pm
SOLVE

Finnaly, i use this version :

Quote
EDITED VERSION FOR EASY ASSIGNEMENT OF THE IRQ PIN
Download with example code from this link: http://www.megaupload.com/?d=MN6A8JC0

It's works, but the keymap is wrong with my azerty keyboard.
8  Forum 2005-2010 (read only) / Interfacing / Re: An other PS2 keyboard problem on: August 22, 2010, 01:17:22 pm
@Richard Crowley At the bottom of you page http:// http://www.arduino.cc/playground/Main/PS2Keyboard, there is a link to the latest version of this library "EDITED AGAIN - Actually mostly rewritten - Version 2.0" : http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html ;

 I try with this library from the begining...  

On the wiki page, thez say : "The PS2Keyboard library uses one of the two available external interrupts to react on keyboard input. Once such input is received, it's stored in a one-byte buffer and is available to be read."

There is a special PIN on arduino board for interrupt ? Or any digital PIN ?
9  Forum 2005-2010 (read only) / Interfacing / Re: An other PS2 keyboard problem on: August 21, 2010, 10:15:07 am
Thank you richard, i will try to be clearer with this schema :

And this is the example schema of the library :


Ground and +v are OK because  3 dels of the keyboard once flash (as when we start a pc).

Any ideas ?
10  Forum 2005-2010 (read only) / Interfacing / Re: An other PS2 keyboard problem on: August 21, 2010, 02:47:58 am
up  :smiley
11  Forum 2005-2010 (read only) / Interfacing / An other PS2 keyboard problem on: August 20, 2010, 03:56:27 am
Hi,

I try to use the library "PS2Keyboard" with a freeduino v1.16 and a MiniDIN 6-Pin Connector from Sparkfun.

I connect the miniDIN to the freeduino like this


I use this code (from exemple) :
Code:
#include <PS2Keyboard.h>

const int DataPin = 8;
const int IRQpin =  5;

PS2Keyboard keyboard;

void setup() {
  delay(1000);
  keyboard.begin(DataPin, IRQpin);
  Serial.begin(9600);
  Serial.println("Keyboard Test:");
}

void loop() {
  if (keyboard.available()) {
    
    // read the next key
    char c = keyboard.read();
    
    // check for some of the special keys
    if (c == PS2_ENTER) {
      Serial.println();
    } else if (c == PS2_TAB) {
      Serial.print("[Tab]");
    } else if (c == PS2_ESC) {
      Serial.print("[ESC]");
    } else if (c == PS2_PAGEDOWN) {
      Serial.print("[PgDn]");
    } else if (c == PS2_PAGEUP) {
      Serial.print("[PgUp]");
    } else if (c == PS2_LEFTARROW) {
      Serial.print("[Left]");
    } else if (c == PS2_RIGHTARROW) {
      Serial.print("[Right]");
    } else if (c == PS2_UPARROW) {
      Serial.print("[Up]");
    } else if (c == PS2_DOWNARROW) {
      Serial.print("[Down]");
    } else if (c == PS2_DELETE) {
      Serial.print("[Del]");
    } else {
      
      // otherwise, just print all normal characters
      Serial.print(c);
    }
  }
}

Problem : When i upload the code, i just gest the message "Keyboard Test:" in the serial console  and 3 dels of the keyboard once flash (as when we start a pc). That's all...

Any idea of the problem ? Is-there a problem between my connector and my freeduino ?

Thanks in advance  


12  Forum 2005-2010 (read only) / Exhibition / Re: Breathalyzer with MQ-3 and Arduino on: August 23, 2010, 01:40:09 pm
Thanks for your link. I also checked http://en.wikipedia.org/wiki/Breathalyzer#Calibration but there is no DIY solution...
13  Forum 2005-2010 (read only) / Exhibition / Re: Breathalyzer with MQ-3 and Arduino on: August 23, 2010, 12:56:23 pm
Hi guys,

I bought the MQ-3 sensor. It's easy to read the value of the sensor with an analog pin.

BUT i have a big problem : i need to calibrate the detector for 0,4mg/L (approximately 200ppm) of Alcohol concentration in air..

How get exactly 0,4 mg/L of Alcohol concentration in air ? :-/

Pages: [1]