Example #1
0
File: vga.c Project: kkaneda/vm
static void
init_curses(void)
{
	Initscr ( ); 			/* initialize the curses library */
	Keypad ( stdscr, TRUE );	/* enable keyborad mapping */
	Scrollok ( stdscr, TRUE );
	Nonl ( );			/* tell curses not to do NL->CR/NL on output */
	Cbreak ( );			/* take input chars one at a time, no wait for \n */
	Noecho ( );			/* don't echo input */
}
Example #2
0
int main(void) {
	const byte rows = 4; //four rows
	const byte cols = 3; //three columns
	char keys[rows][cols] = {
	  {'1','2','3'},
	  {'4','5','6'},
	  {'7','8','9'},
	  {'*','0','#'}
	};
	byte	rowPins[rows] = {J1_9, J1_8, J1_7, J1_6};	//connect to the row pinouts of the keypad
	byte	colPins[cols] = {J1_5, J1_4, J1_3};			//connect to the column pinouts of the keypad
	Serial	pc(PA_1, PA_0);
	Keypad	keypad = Keypad( makeKeymap(keys), rowPins, colPins, rows, cols );
	pc.baud(19200);
	pc.println("InputNumber");
	wait_ms(500);
	while (1) {
		char c = keypad.getKey();
		if (c)
			pc.write(c);
	}
}
Example #3
0
#include "Keypad.h"

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {4, 3, 2}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() {
    Serial.begin(9600);
}

void loop() {
    char key = keypad.getKey();

    if (key != NO_KEY) {
        Serial.println(key);
    }
}
Example #4
0
#include "atmicro.h"
#include "config.h"
#include "box/interface.h"

ParallelTextLCD lcd = ParallelTextLCD(IOPORTB, IOPIND4, IOPIND3, IOPIND2);
DigitalOutput backlight = DigitalOutput(IOPIND5);
DigitalOutput buzzer = DigitalOutput(IOPIND6);
DigitalOutput led = DigitalOutput(IOPIND7);
Accelerometer acclm = Accelerometer(ADC0, ADC1, ADC2);
Keypad pad = Keypad(IOPORTC);
State state;
Istream istream;

int main(void)
{
	acclm.start();
	delay(1000);
	backlight.on();
	lcd.clear();
	state.setLockAccelerations(acclm);
	delay(1000);
 	while(1)
 	{
		istream.update(pad);
		interface(istream, lcd, state, acclm);
		#if DEBUG_MODE == true
			lcd.print(0, 1, acclm.x - state.lockAccX);
			lcd.print(4, 1, acclm.y - state.lockAccY);
			lcd.print(8, 1, acclm.z - state.lockAccZ);
			lcd.print(13, 1, state.safe);
		#endif
Example #5
0
    {6,6,6},{1,0,7},{1,8,1}, // 6,7,8
    {1,0,9}
};
uint8_t bbdur[2] = {60,100}; // 75 ms for MF tones, 120 for KP/ST
int ss4Tone[2] = {2040,2400}; // tones for 0,1 respectively
char keys[4][4] = {
    {'1','2','3','a'},
    {'4','5','6','b'},
    {'7','8','9','c'},
    {'#','0','*','d'}
};
byte rowPins[4] = {5,4,3,2}; //connect to the row pinouts of the keypad
byte colPins[4] = {9,8,7,6}; //connect to the column pinouts of the keypad
// global objects
Tone freq[2]; // array of Tone objects, now we can play as freq[0].play(); etc
Keypad keypad = Keypad(makeKeymap(keys),rowPins,colPins,4,4);
boolean rec = 0; // recording on/off
boolean stored = 0; // stored digits?
boolean autoDial = 0; // are we playing stored ANY didgits?
int mode = 0; // 0 for MF, 1 for intern, 2 for SS4, 3 for DP, 4 for DTMF
int mf2 = 0; // MF2 mode
// the storage of integers MUST be integers (int):
int store[24] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
// call set up function to set up pins:
void setup(void) { // Start up instructions:
    freq[0].begin(11); // Initialize our first tone generator
    freq[1].begin(12); // Initialize our second tone generator
    keypad.setHoldTime(1500); // hold for two seconds to change state to HOLD
    pinMode(10, INPUT); // 2600 button
    pinMode(13, OUTPUT); // LED for recording
    keypad.addEventListener(procButton);