Pages: [1]   Go Down
Author Topic: How to use a hex inverter???  (Read 3146 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Gold Merc Taxi Service
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to use a hex inverter to create a DPDT switch which can be controlled by a single pin on the arduino board.

Below is a bad drawing of my circuit (Please forgive me - I am an electronics newbie!)



A is connected to a pin on the arduino board.

The idea is that when ...

A is HIGH,     B is HIGH and C is LOW
and when ...
A is LOW,     B is LOW and C is HIGH

Anyway, its not working. I guess i'm doing this totally wrongly. Could somebody please put me right??

(merry christmas! to you all and I wish you a geeky 2006!)
Logged

my hobby --  www.jonathanbryan.com

my life --  www.ifranks.com  [link]www.silver-collector.com[/link] [link]www.da

Forum Administrator
MMX
Offline Offline
Edison Member
*****
Karma: 37
Posts: 1139
hallo kompis
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hej,

sorry for the delay, we took a couple of days vacation visiting mum and eating Xmas candy ;-)

However your circuit looks great to me. I think you plugged everything right. The only thing I could ask is:

a) how big is your resistor?

b) can you take a picture of the circuit as you mounted it and upload it?

/David
Logged

London
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Gold Merc Taxi Service
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi David,

thanks for the help.

here is a picture of my circuit....



the long orange wire is the output, 'A' in my circuit diagram.

the two green wires are connected back onto the arduino board, for the purposes of testing. they are B & C

the resistor is 10Kohms

This is the 'quick and dirty' program I have on the arduino board to test the circuit...

------------------------------

int inA = 0;
int inB = 0;

void setup()
{
 pinMode(11, OUTPUT);  
 pinMode(9, INPUT);  
 pinMode(8, INPUT);              
 beginSerial(9600);
}

void loop()
{
 digitalWrite(11, HIGH);

 inA = digitalRead(smiley-cool;
 inB = digitalRead(9);
 printByte('h');
 if (inA == 0) printByte('0');
   else printByte('1');
 printByte(' ');
 if (inB == 0) printByte('0');
   else printByte('1');
 printByte(10);
 printByte(13);  

 delay(1000);  
 
 digitalWrite(11, LOW);

 inA = digitalRead(smiley-cool;
 inB = digitalRead(9);
 inA = 0;
 printByte('l');
 if (inA == 0) printByte('0');
   else printByte('1');
 printByte(' ');
 if (inB == 0) printByte('0');
   else printByte('1');
 printByte(10);
 printByte(13);

 delay(1000);
}

------------------------------

i get the following repeating output in ZTerm

h   0   1
l   0   0

meaning that when A is High, B is High and C is Low
and when A is Low, B is Low and C is Low.

So, something is obviously wrong.

what does the digital doctor suggest??
« Last Edit: January 04, 2006, 06:50:15 pm by stinky » Logged

my hobby --  www.jonathanbryan.com

my life --  www.ifranks.com  [link]www.silver-collector.com[/link] [link]www.da

Forum Administrator
MMX
Offline Offline
Edison Member
*****
Karma: 37
Posts: 1139
hallo kompis
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hej,

take a look at your program:

Quote
delay(1000);    
    
  digitalWrite(11, LOW);
 
  inA = digitalRead(smiley-cool;
  inB = digitalRead(9);

  // THIS IS IT!!
  // YOU ARE MAKING INA BECOME 0 AGAIN!!

  inA = 0;


  printByte('l');
  if (inA == 0) printByte('0');
    else printByte('1');
  printByte(' ');
  if (inB == 0) printByte('0');
    else printByte('1');
  printByte(10);


Saw it?

;-)

/David
Logged

London
Offline Offline
Newbie
*
Karma: 0
Posts: 31
Gold Merc Taxi Service
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

whoops! how embarrassing!!!

yeah, i put that line in at one point, when I was trying to debug things and I forgot to remove it. without it, everything works as expected!

I put a scratch through that line, so that anybody looking at this thread can easily see what was wrong.

I hope the pictures will be useful to anyone else trying to do the same thing.

Thanks doctor - I'll try not to waste your time in future!!
Logged

my hobby --  www.jonathanbryan.com

my life --  www.ifranks.com  [link]www.silver-collector.com[/link] [link]www.da

Forum Administrator
MMX
Offline Offline
Edison Member
*****
Karma: 37
Posts: 1139
hallo kompis
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No waist,

a pleasure

/D
Logged

Pages: [1]   Go Up
Jump to: