links · people · groups · tags | My: links · tags · groups · watchlists · notes login · sign up now! | help · blog
Simpy simpy
 
Michael Shook, member since May 27, 2004
.
Search Everyone: "c",
1 - 14 of 14   Watch mshook
 
/*send the packet*/
send_result = sendto(s, buffer, ETH_FRAME_LEN, 0, 
	      (struct sockaddr*)&socket_address, sizeof(socket_address));
if (send_result == -1) { errorhandling... }

Example 1.6. Receive a RAW ethernet frame

void* buffer = (void*)malloc(ETH_FRAME_LEN); /*Buffer for ethernet frame*/
int length = 0; /*length of the received frame*/ 
...
length = recvfrom(s, buffer, ETH_FRAME_LEN, 0, NULL, NULL);
if (length == -1) { errorhandling .... }
by mshook 2009-10-15 22:15 ethernet · 802 · packet · howto · code · mac · ip · c · example
http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch01s03.html - cached - mail it - history

* is Unix

Jacob Kaplan-Moss

October 7, 2009

by mshook 2009-10-08 00:07 c · ruby · python · example · code · minimal · server · viapopular · good · linux · perl · how · network · socket · process
http://jacobian.org/writing/star-is-unix/ - cached - mail it - history
//dirt cheap wireless TX
//generates 38kHz carrier wave on pin 9 and 10
//sends data via TX every 500ms
void setup()
{
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);

  // Clear Timer on Compare Match (CTC) Mode
  bitWrite(TCCR1A, WGM10, 0);
  bitWrite(TCCR1A, WGM11, 0);
  bitWrite(TCCR1B, WGM12, 1);
  bitWrite(TCCR1B, WGM13, 0);

  // Toggle OC1A and OC1B on Compare Match.
  bitWrite(TCCR1A, COM1A0, 1);
  bitWrite(TCCR1A, COM1A1, 0);
  bitWrite(TCCR1A, COM1B0, 1);
  bitWrite(TCCR1A, COM1B1, 0);

  // No prescaling
  bitWrite(TCCR1B, CS10, 1);
  bitWrite(TCCR1B, CS11, 0);
  bitWrite(TCCR1B, CS12, 0);

  OCR1A = 210;
  OCR1B = 210;

  Serial.begin(2400);
}

void loop()
{
  Serial.println("testing testing testing");
  delay(500);
}


by mshook 2009-09-27 21:21 arduino · avr · code · timer · ir · infrared · receiver · transmitter · serial · howto · circuitled · modulation · c
http://tthheessiiss.wordpress.com/2009/08/05/dirt-cheap-wireless/ - cached - mail it - history
void httpRequest()
{
  byte theByte;

  xPortSerial.print("GET ");
  xPortSerial.print(PHP_PAGE_LOCATION);

  // value0 = 123 and value1 = 456
  // You should change these to be your sensor values or whatever you want to send
  // (see php code if you want to add more values or change the names value0/value1
  xPortSerial.print("?value0=123&value1=456");
  xPortSerial.print(" HTTP/1.1n");
  xPortSerial.print(WEB_HOST);

  while(!xPortSerial.available()) {} // Just loop until available
  theByte = xPortSerial.read();
  if (theByte != 0)
    Serial.println("Passed.");
  else
    Serial.println("Failed.");
}
by mshook 2009-07-02 05:44 arduino · ethernet · server · client · avr · howto · code · php · c · sheild
http://www.glacialwanderer.com/hobbyrobotics/?p=15 - cached - mail it - history

Introducing Bitlash

Bitlash is an open source interpreted language shell for the Arduino serial port. It runs on the Arduino and interprets commands that you type in a terminal window or send programmatically:

bitlash v0.95a here! ... > print "hello, world", analogRead(3) hello, world 552

Bitlash is a development and prototyping tool for those situations where you need to bang some bits on the Arduino but writing a sketch in C is premature. The Bitlash command language is very similar to Arduino C and includes a large repertiore of the familiar Arduino C functions so you can hack your hardware from the serial command line or even over the internet via telnet.

by mshook 2009-06-30 18:44 arduino · c · very · cool · free · open · source · interpreter · avr · concise · small · macro
http://bitlash.net/ - cached - mail it - history
hardware/tools/avrdude -Chardware/tools/avrdude.conf -v -v -v -v -pm328p -cstk500v1 -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/home/michael/arduino/BlinkArduinoLED.hex:i
by mshook 2009-06-27 18:20 example · c · blink · asm · assembler · avr · arduino · code · howto · upload
http://code.google.com/p/tinyprojects/source/browse/trunk/avr/ - cached - mail it - history
void setup(){
  pinMode(13, OUTPUT);
}
 
void loop(){
  digitalWrite(13, HIGH);
  delay(500);
  digitalWrite(13, LOW);
  delay(500);
}

First, we configure pin 13 for output by setting a bit in Data Direction Register B. Then we turn pin 13 by setting its bit in PORTB. Then we delay 500 milliseconds by marking the current value of timer0, converted into milliseconds, and letting the counter be incremented repeatedly at each clock cycle and overflowed into ever larger holders until the new value of timer0 represents an elapsed time of 500ms. Next we set the bit for pin 13 in PORTB low to turn the LED off. We do the delay dance again and we're home.

by mshook 2009-06-14 16:18 arduino · avr · how · code · c · microcontroller · good · long · macro
http://www.urbanhonking.com/ideasfordozens/2009/05/an_tour_of_the_arduino_interna.html - cached - mail it - history
by mshook 2009-05-19 00:06 gnb · avr · up · how · assembler · c · wishlist · music · synth · 8bit
http://www.google.com/notebook/html?nbid=BDQmISgoQ4vfT_JQk - cached - mail it - history

For something even smaller, download miniPicoLisp.tgz. It is a minimal version, without support for databases, UTF-8, bignums, IPC, networking and other system-dependent functions. A kind of "pure" Pico Lisp (not "pure Lisp"!). It supports the full Pico Lisp language, but runs faster, and uses even less memory space. It should also not be restricted to Unix. In addition, it compiles and runs also on 64-bit systems.

Jon Kleiser wrote an OpenGL library gl.tgz, and a Chinese Checkers program running on top of it.

by mshook 2009-05-17 19:45 lisp · c · small · tiny · scheme · up · how
http://www.software-lab.de/down.html - cached - mail it - history

Example: sum of first 4 integers.

sum = 0;
for (i = 1; i <= 4; ++i)
   sum += i*i;
can be translated to
sum = 0;
i = 1;
loop:
   if (i == 5) goto end;;
   sum = sum + i;
   i = i + 1;
goto loop;
end:
can be translated to
; sum in R16
; i in R17
; R18,R19 used for temporary values
    LDI R16, 0
    LDI R17, 1
    LDI R18, 5
    SUB R18, R17
    BRBS 1, 22
    ADD R16, R17
    LDI R19, 1
    ADD R17, R19
    JMP 2
    SLEEP

by mshook 2009-05-16 22:45 slides · assembler · c · compile · howto · avr · up · arduino · example · code
http://www.cse.unsw.edu.au/~cs1721/05s2/lectures/slide52.html - cached - mail it - history
by mshook 2009-05-13 09:16 d4m · template · html · list · 13 · may · 2009 · c · tinyurl · qsbfez · ul · li
http://mshook.googlepages.com/d4m.htm?/mshook/13+may+2009+c - cached - mail it - history
by mshook 2009-03-31 18:37 31 · march · 2009 · c · audio · rf · tv · radio · satellite · filter · transmitter · etc · circuit · schematic · tutorial
http://michaelgellis.tripod.com/tutorial.html - cached - mail it - history
by mshook 2008-07-21 14:44 dtmf · generator · c · telephone · linux · ubuntu · sound
http://packages.ubuntu.com/source/hardy/dtmfdial - cached - mail it - history
I urge everybody to play the game first, at least ten times, before reading on. But you cannot fully appreciate the astonishing brilliance of its design until you have seen all of the surprises that have been built in. I believe this program is entirely faithful to the behavior of Adventure Version 1.0, except that I have slightly edited the computer messages (mostly so that they use both lowercase and uppercase letters). I have also omitted Woods’s elaborate machinery for closing the cave during the hours of prime-time computing; I believe John McCarthy insisted on this, when he saw the productivity of his AI Lab falling off dramatically (although it is rumored that he had a special version of the program that allowed him to play whenever he wanted). And I have not adopted the encryption scheme by which Woods made it difficult for users to find any important clues in the binary program file or core image; such modifications would best be done by making a special version of CTANGLE. All of the spelunking constraints and in
by mshook 2008-01-19 18:27 game · knuth · pdf · how · wishlist · if · interactive · fiction · literate · c
http://literateprogramming.com/adventure.pdf - cached - mail it - history
1 - 14 of 14  
Related Tags
 
- exclude ~ optional + require
Add Dates