Habilitar una función o codigo al presionar un boton


saludos ..

tome como ejemplo  este codigo del ide ,  quisiera habilitar   al presionar un boton ,  el codigo b


no quiero que me hagan el codigo si no que me den una orientacion y el orden de como deberia funcionar

saludos..



codigo es codigo principal

code: [select]



#include <liquidcrystal.h>

// initialize library numbers of interface pins
liquidcrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set lcd's number of columns , rows:
  lcd.begin(16, 2);
  // print message lcd.
  lcd.print("hello, world!");
}

void loop() {
  // set cursor column 0, line 1
  // (note: line 1 second row, since counting begins 0):
  lcd.setcursor(0, 1);
  // print number of seconds since reset:
  lcd.print(millis() / 1000);
}




este código sería el que se habilitaría al presionar el boton, sería como un botón automático

codigo b


code: [select]



#include <max6675.h>
#include <liquidcrystal.h>
#include <wire.h>

int thermodo = 4;
int thermocs = 5;
int thermoclk = 6;

max6675 thermocouple(thermoclk, thermocs, thermodo);
int vccpin = 3;
int gndpin = 2;

liquidcrystal lcd(8, 9, 10, 11, 12, 13);

// make cute degree symbol
uint8_t degree[8]  = {140,146,146,140,128,128,128,128};

void setup() {
  serial.begin(9600);
  // use arduino pins
  pinmode(vccpin, output); digitalwrite(vccpin, high);
  pinmode(gndpin, output); digitalwrite(gndpin, low);
  
  lcd.begin(16, 2);
  lcd.createchar(0, degree);

  // wait max chip stabilize
  delay(500);
}

void loop() {
  // basic readout test, print current temp
  lcd.clear();
  lcd.setcursor(0, 0);
  lcd.print("max6675 test");
  
  // go line #1
  lcd.setcursor(0,1);
  lcd.print(thermocouple.readcelsius());
#if arduino >= 100
  lcd.write((byte)0);
#else
  lcd.print(0, byte);
#endif
  lcd.print("c ");
  lcd.print(thermocouple.readfahrenheit());
#if arduino >= 100
  lcd.write((byte)0);
#else
  lcd.print(0, byte);
#endif
  lcd.print('f');
  
  delay(1000);
}





el primer código ni siquiera tiene un botón?


Arduino Forum > International > Español (Moderators: surbyte, Hector_A) > Habilitar una función o codigo al presionar un boton


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts