Miren soy nuevo en esto de la programacion y de la elctronica, pero ahorita quiero encender un led apachurrando un boton y cuando de nuevo apachurre el boton se apague. el programa esta en pic c....... bueno ahorita tengo este programa de encender un led,,,,,, que es lo que puedo hacer para que se apague nuevamente.
#include "C:\Users\asus\Documents\Proyecto\Encender un motor\Encender un motor.h"
#BYTE puerto_a=0x05
#BYTE puerto_b=0x06
#define b0 bit_test(puerto_a,0)
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// TODO: USER CODE!!
set_tris_b(0x00);
puerto_b=0;
set_tris_a(0b00000001);
puerto_a=0;
do{
if(b0){
puerto_b=00000001;
do{
}while(b0);
}//hasta este punto, esta prendido el led.
}while(true);
}
#include "C:\Users\asus\Documents\Proyecto\Encender un motor\Encender un motor.h"
#BYTE puerto_a=0x05
#BYTE puerto_b=0x06
#define b0 bit_test(puerto_a,0)
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
// TODO: USER CODE!!
set_tris_b(0x00);
puerto_b=0;
set_tris_a(0b00000001);
puerto_a=0;
do{
if(b0){
puerto_b=00000001;
do{
}while(b0);
}//hasta este punto, esta prendido el led.
}while(true);
}