#include "suryaa.h"
void setup()
{
pin_configure();
}
void loop()
{
volatile char x,a[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
volatile long i,j,count=0;
while(1)
{
x=input();
if((x & 0x01)==0x01 || (x & 0x08)==0x08 || (x & 0x40)==0x40 || (x & 0x80)==0x80)
count=count+1;
else
output(0x00);
if(count==4)
{
//for(j=0;j<1000000;j++);
output(0x80);
for(j=0;j<1000000;j++);
break;
}
else
output(0x00);
}
}
/*void loop() {
volatile char x, a[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
volatile long j, count = 0;
while (1) {
x = input();
count = 0; // Reset count on each iteration
// Count the number of specified switches pressed
for (int i = 0; i < 8; i++) {
if (x & a[i]) {
count++;
}
}
// If exactly 4 specified switches are pressed one by one
if (count == 4) {
for (int i = 0; i < 5; i++) { // Check the sequence
if (!(x & a[i]) || !(x & a[i+1]) || !(x & a[i+2]) || !(x & a[i+3])) {
count = 0; // Reset count if sequence not found
break; // Exit loop if sequence not found
}
}
// If sequence found, turn on LED and break out of loop
if (count == 4) {
output(0x80); // Turn on LED
for (j = 0; j < 1000000; j++); // Delay
break; // Exit loop
}
}
output(0x00); // Turn off LED if condition not met
}
}*/
//#include "suryaa.h"
/*void setup()
{
configure_pin();
}
void loop()
{
volatile long i,j;
volatile char a[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0X6F};
for(i=2;i<10;i++)
{
int y=0;
y=is_prime(i);
if(y==1)
output(a[i]);
for(j=0;j<200000;j++);//delay
}
}
void setup()
{
volatile char *dirf,*dirk;
volatile char *outf,*ink;
volatile long i,j;
dirf=(char*)0x30; //portf direction register
*dirf=0x01; //portf pin configure
outf=(char*)0x31;ink=(char *)0x106; //portf data register.
//*outf=0x01; //portf pin value.
dirk=(char *)0x107; //portk direction register
*dirk=0x00; //portk pin configure
ink=(char *)0x106;//portk input register
//access value in run time of input register.
i=0;
while(1)
{
volatile char x=*ink;
if((x & 0x01)==0x01)
{
i++;
for(j=0;j<50000;j++);
}
if(i%2==1)
*outf=0x01;
else
*outf=0x02;
}
}
void loop()
{
}*/
mega:SCL
mega:SDA
mega:AREF
mega:GND.1
mega:13
mega:12
mega:11
mega:10
mega:9
mega:8
mega:7
mega:6
mega:5
mega:4
mega:3
mega:2
mega:1
mega:0
mega:14
mega:15
mega:16
mega:17
mega:18
mega:19
mega:20
mega:21
mega:5V.1
mega:5V.2
mega:22
mega:23
mega:24
mega:25
mega:26
mega:27
mega:28
mega:29
mega:30
mega:31
mega:32
mega:33
mega:34
mega:35
mega:36
mega:37
mega:38
mega:39
mega:40
mega:41
mega:42
mega:43
mega:44
mega:45
mega:46
mega:47
mega:48
mega:49
mega:50
mega:51
mega:52
mega:53
mega:GND.4
mega:GND.5
mega:IOREF
mega:RESET
mega:3.3V
mega:5V
mega:GND.2
mega:GND.3
mega:VIN
mega:A0
mega:A1
mega:A2
mega:A3
mega:A4
mega:A5
mega:A6
mega:A7
mega:A8
mega:A9
mega:A10
mega:A11
mega:A12
mega:A13
mega:A14
mega:A15
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C
btn3:1.l
btn3:2.l
btn3:1.r
btn3:2.r
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn4:1.l
btn4:2.l
btn4:1.r
btn4:2.r
btn5:1.l
btn5:2.l
btn5:1.r
btn5:2.r
btn6:1.l
btn6:2.l
btn6:1.r
btn6:2.r
btn7:1.l
btn7:2.l
btn7:1.r
btn7:2.r
btn8:1.l
btn8:2.l
btn8:1.r
btn8:2.r
r1:1
r1:2
r2:1
r2:2
r3:1
r3:2
r4:1
r4:2
r5:1
r5:2
r6:1
r6:2
r7:1
r7:2
r8:1
r8:2
r9:1
r9:2
r10:1
r10:2
r11:1
r11:2
r12:1
r12:2
r13:1
r13:2
r14:1
r14:2
r15:1
r15:2
r17:1
r17:2