All Forums > Programming Questions

Pullup no works

(1/2) > >>

ldalep:
 ???
I have an ardruno sketch that when I compiled it in wiring I noticed that the pullups no longer worked.  I have tried in vain going from

digitalwrite(XXX, HIGH)
to
pullup(XXX)

no worky ATML328P 16mhz

bhagman:
can you post your sketch, explain a bit about what you want it to do?

Also, which board are you using?

ldalep:
Thanks for the quick responce

I have a key pad and some buttons in the sketch that worked fine in ardrunio land.  I used the writedigital to use the internal pull up resistors.  Now some of the pins (A3) for one and some of the keypad pins no longer work   

I am using the Adrurino Pro (5V 16Mhz) w/atml328

As an aside I can get the keyboard to work fine in wiring when I use just the Keyboard example sketch


--- Code: ---#include <Keypad.h>
#include <EEPROM.h>
//#include <MsTimer2.h>
#include <TimedAction.h>



const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns

String Inputstring="";
String Cmdstring="";
boolean Master = false;
boolean Sechalf= false;
unsigned long inval=0;
int Rtime=0;

int rel1count=0;
int TOGGLEcount=0;

int Codelen=0;
int keycounter =0;
boolean keyboardlk=false;

boolean pb=false;
boolean rel1=false;
boolean TOGGLE=false;
boolean valpart=false;
int memslot=0;

const int FADEAMOUNT=10;
const int PUSHBUTTON=12;
const int RESET =A3;
const int GREENLED =9;
const int REDLED = A0;
const int YELLOWLED =10;
const int REL1=A1;

const int STARTMEMREL1 = 0;
const int ENDMEMREL1 = 297;
const int MEMTOGGLE = 300;
const int R1ENTRY=20;
const int CODLEN=4;

const int MEMREL1TIME= 305;
const int MEMREL2TIME= 307;
const int MEMBOOT=511;
const int DEFR1SEC=5;


const int MEMMASTER = 310;
const unsigned long DEFMASTER=1234;
const unsigned long MAXINT=1048575;

char keys[ROWS][COLS] = {
  {
    '1','2','3'                  }
  ,
  {
    '4','5','6'                  }
  ,
  {
    '7','8','9'                  }
  ,
  {
    '*','0','#'                  }
};
byte rowPins[ROWS] = {
  2, 4, 5, 7}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {
  8, 6 , 3}; //connect to the column pinouts of the keypad
int brightness = 125;    // how bright the LED is
int fadeAmount = 0;    // how many points to fade the LED by
//int incomingByte = 0; // for incoming serial data

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
TimedAction timedout = TimedAction(60000,abort);
TimedAction clocktime = TimedAction(500,Timeclear);

void setup(){
  Serial.begin(9600);

  Codelen=CODLEN;
  //MsTimer2::set(60000, abort); // 500ms period
  //MsTimer2::stop();
  timedout.disable();
  clocktime.disable();
  pinMode(GREENLED, OUTPUT);
  pinMode(REDLED,OUTPUT);
  pinMode(YELLOWLED,OUTPUT);
  pinMode(REL1,OUTPUT);



  pinMode(RESET,INPUT);
  digitalWrite(RESET,HIGH);
  //pullup(RESET);

  pinMode(PUSHBUTTON,INPUT);
  digitalWrite(PUSHBUTTON,HIGH);
  //pullup(PUSHBUTTON);


--- End code ---

ldalep:
Any word on this issue.... do you need more info

bhagman:
Just after a quick look, I think the problem is that you're using the "A3" constant - which will result in an entirely different result than what Arduino has done with those constants.

Here is what you should change:


--- Code: ---const int FADEAMOUNT = 10;
const int PUSHBUTTON = 12;
const int RESET = 27;   // A3;
const int GREENLED = 9;
const int REDLED = 24; // A0;
const int YELLOWLED = 10;
const int REL1 = 25; // A1;

--- End code ---

Try that.

Navigation

[0] Message Index

[#] Next page

Go to full version