Just an LED and a resistor.
This module is usually employed to indicate some kind of status, as a very simple way to get information from inside a microcontroller or circuit.
Contents |
Bill of materials:
The LED will light when the microcontroller data pin is set as a digital output at logic "1".
The LED will not light when the data pin is set at a logic "0", or when it's working as a digital or analog input.
You can use the LED color you want.
You might want to change the resistor value, depending on the LED type and brightness you want.
You can also build a short version without wires.
This Module only supports single-color LEDs. If you want to use multicolor or very bright LEDs take a look at other Modules.
Printable version: Single, Quad
/*================================================================== * Sample program for LTIND-A using an MBP18 * * This program configures all available pins as digital outputs. * Plug Module LTIND-A to any pin. It will light up and then * stop every second. RA5 is an input-only pin, so the LED will * not light there * Note: PIC16F88 runs by default at 31.25kHz (internal oscillator) * * http://curuxa.org *=================================================================*/ #include <pic16f88.h> typedef unsigned int config; config at _CONFIG1 __CONFIG = _CP_OFF & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_IO; //Simple delay for an unspecified amount of time void Delay(){ long i; for (i=0; i<200; i++) { //do nothing } } void main(){ //set all pins as digital, instead of analog inputs ANSEL=0; //set all digital pins as outputs TRISA=0; TRISB=0; while(1){ //Turn LED on PORTA=0b11111111; PORTB=0b11111111; Delay(); //Turn LED off PORTA=0; PORTB=0; Delay(); } }
/*================================================================== * Sample program for LTIND-A using an MBP40 * * This program configures all available pins as digital outputs. * Plug Module LTIND-A to any pin. It will light up and then * stop every second. RE3 (pin 1) is an input-only pin, so the LED * will not light there * * http://curuxa.org *=================================================================*/ #include <pic16f887.h> typedef unsigned int config; config at _CONFIG1 __CONFIG = _CP_OFF & _DEBUG_OFF & _FCMEN_OFF & _IESO_OFF & _CPD_OFF & _LVP_OFF & _BOR_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO; #define DigitalInput 1 #define DigitalOutput 0 #define AllDigitalInputs 0xFF #define AllDigitalOutputs 0x00 //Delay the program for a given amount of milliseconds void Delay(unsigned long ms){ unsigned long i; while(ms--){ for (i=0; i<80; i++) { //do nothing } } } //Set the internal oscillator to 8MHz void SetIntosc8MHz(){ IRCF2=1; IRCF1=1; IRCF0=1; } //Disable Analog-to-Digital converter on a MBP40 void AdcDisable(){ ADON=0; ANSEL=0; ANSELH=0; } void main() { SetIntosc8MHz(); AdcDisable(); TRISA=AllDigitalOutputs; TRISB=AllDigitalOutputs; TRISC=AllDigitalOutputs; TRISD=AllDigitalOutputs; TRISE=AllDigitalOutputs; while(1) { PORTA=0b11111111; PORTB=0b11111111; PORTC=0b11111111; PORTD=0b11111111; PORTE=0b11111111; Delay(1000); PORTA=0; PORTB=0; PORTC=0; PORTD=0; PORTE=0; Delay(1000); } }