Skip to content

Instantly share code, notes, and snippets.

void setup() {
Serial.begin(9600);
}
void loop() {
int color[8] = {COLOR_NONE,COLOR_BLUE,COLOR_GREEN,COLOR_CYAN,COLOR_RED,COLOR_YELLOW,COLOR_MAGNETO,COLOR_WHITE};
for(int i=0;i<8;i++)
{
rgbWrite(color[i]);
delay(1000);
#include <reg51.h>
sbit LED = P2^0; // Bling the single LED connected to P2.0
void DELAY_ms(unsigned int ms_Count)
{
unsigned int i,j;
for(i=0;i<ms_Count;i++)
{
for(j=0;j<100;j++);
#include <reg51.h>
void DELAY_ms(unsigned int ms_Count)
{
unsigned int i,j;
for(i=0;i<ms_Count;i++)
{
for(j=0;j<100;j++);
}
}
#include "lcd.h"
int main()
{
/*Connect RS->P2.0, RW->P2.1, EN->P2.2 and data bus to P2.4 to P2.7*/
LCD_SetUp(P2_0,P2_1,P2_2,P_NC,P_NC,P_NC,P_NC,P2_4,P2_5,P2_6,P2_7);
LCD_Init(1,16);
LCD_DisplayString("Explore Embedded");
LCD_GoToLine(1);
#include "lcd.h"
int main()
{
/*Connect RS->P2.0, RW->P2.1, EN->P2.2 and data bus to P2.4 to P2.7*/
LCD_SetUp(P2_0,P2_1,P2_2,P_NC,P_NC,P_NC,P_NC,P2_4,P2_5,P2_6,P2_7);
LCD_Init(4,20);
LCD_DisplayString("Explore Embedded\n");
LCD_DisplayString("LCD 4-bit Mode\n");
#include "lcd.h"
int main()
{
/*Connect RS->P2.0, RW->P2.1, EN->P2.2 and data bus to P2.4 to P2.7*/
LCD_SetUp(P2_0,P2_1,P2_2,P_NC,P_NC,P_NC,P_NC,P2_4,P2_5,P2_6,P2_7);
LCD_Init(1,16);
LCD_DisplayString("Explore Embedded\n");
while(1);
#include "rtc.h"
#include "lcd.h"
int main()
{
rtc_t rtc;
/*Connect RS->P2.0, RW->P2.1, EN->P2.2 and data bus to P2.4 to P2.7*/
LCD_SetUp(P2_0,P2_1,P2_2,P_NC,P_NC,P_NC,P_NC,P2_4,P2_5,P2_6,P2_7);
LCD_Init(2,16);
#include <reg51.h>
#define SegOne 0x01
#define SegTwo 0x02
#define SegThree 0x04
#define SegFour 0x08
void DELAY_ms(unsigned int ms_Count)
{
unsigned int i,j;
#include <reg51.h>
void DELAY_ms(unsigned int ms_Count)
{
unsigned int i,j;
for(i=0;i<ms_Count;i++)
{
for(j=0;j<100;j++);
}
}
#include<reg51.h>
/* Configure the data bus and Control bus as per the hardware connection
Databus is connected to P2.4:P2.7 and control bus P2.0:P2.2*/
#define LcdDataBus P2
sbit LCD_RS = P2^0;
sbit LCD_RW = P2^1;
sbit LCD_EN = P2^2;
/* local function to generate delay */