Tag Archives: AMIGA

Arduino Diecimila Board Access…

By wisecracker

This is a very simple starter DEMO to access Arduino Diecimila Board for the
Macbook Pro 13″ OSX 10.7.5…
A potentiometer is connected between 5V and Gnd with the wiper connected to
ANALOG IN 0 on the Arduino. This was adjusted to give the Ms and Ls as seen…

I now have DC in for this machine AND Linux too as on my Linux tools the device
becomes /dev/ttyUSB0 …

NOTE:- The device below is for MY machine and WILL be different for yours…

It is assumed that you have a Terminal up and running AND you have NOT
plugged in your USB Arduino Board yet…

Enjoy finding simple solutions to often very difficult problems…

Public Domain and you may do with it as you please…

Code:

Last login: Thu Jul 18 21:58:14 on ttys000
AMIGA:barrywalker~> # Find the USB device first.
AMIGA:barrywalker~> ls /dev/*usb*
ls: /dev/*usb*: No such file or directory
AMIGA:barrywalker~> # Now plug in the Arduino Diecimila Board...
AMIGA:barrywalker~> ls /dev/*usb*
/dev/cu.usbserial-A7007cvs /dev/tty.usbserial-A7007cvs
AMIGA:barrywalker~> # USE the /dev/cu.usbserial-A7007cvs device...
AMIGA:barrywalker~> cat < /dev/cu.usbserial-A7007cvs
MLMMLMMMMMMLMMMMLMLMMLLLLLLMLLMMMMMLMMMLMLLMLMLMMMMMMMMMMMLLMLLLMLLLLLLMLLLMLLM
MMMLMLLMLMMMLMMMMMLMLMLMLMMMLLLMMLLMMMMMMLLLMLLMMLMLLLLLMMMMLMLLLLMMMMMMMLLLMML
MMLMMMLLMLMLMLLMMMMLLLMLMMMMMLLMMLMMMLLMMMLLMMMMMMMMMMLLMLLLMMLLLMLMLMMLMMLMLML
MMMMMLLMMMMLLLLLLMMMMMMLLMLMMMMMLMMMLLMLMLMLLMLMLLLLMMMLMMLMMMMLMLMLMMLMMLMLMML
MLMLLLMLLLLLLMLLMMLMMMLMMMLMMLMLMMLMLMLMMLMLMMMLLLMLMLLLMMLLLMLMLMLLLLLLLMLMMML
LMcMMLLLLMLMMMMLMMMMMLMMLLMLMMMMMMLMLLMMMMMLMMMMLMLLMLMMMLLLMMMMMLLLMLMMLMLMMLM
MLMLLMLMMMMMLLLMMMMLLLMLMMLLMMLLMLLLMMMLLMMMLLMLLLLMMLLMMMMLLMMMMMLLLLLMMLLMMML
MLMMLLLMLLLLM^C
AMIGA:barrywalker~> _


The .PDE file for the Arduino as a test piece, this uses an early version of the
programming SW and I know it won’t compile on current versions so you will have
to modify slightly as required…

Code:

/* Using the Arduino as a DEMO single channel ADC for Windows (TM), Linux, */
/* AMIGA, WinUAE and now the Macbook Pro 13 inch OSX 10.7.5... */

/* Set up a variable for basic analogue input. */
int analogue0 = 0;

void setup() {
/* Open the serial port at 9600 bps. */
Serial.begin(9600);

/* Set the analogue voltage reference, DEFAULT is 5V in this case. */
analogReference(DEFAULT);
}

void loop() {
/* Read the 10 bit analogue voltage on analogue input 0. */
analogue0 = analogRead(0);
/* Convert to a byte value by dividing by 4. */
analogue0 = analogue0/4;

/* Send to the Serial Port the byte value. */
Serial.print(analogue0, BYTE);
}


…read more

Source: FULL ARTICLE at The UNIX and Linux Forums

When is a _function_ not a _function_?

By wisecracker

For a starter I know the braces are NOT in the code…

Consider these code snippets:-

Code:

#!/bin/bash --posix
x=0
somefunction()
if [ $x = 0 ]
then
echo "I am here."
fi
# somefunction

#!/bin/bash --posix
x=0
somefunction()
if [ $x = 0 ]
then
echo "I am here."
fi
somefunction

#!/bin/bash --posix
x=0
somefunction()
echo "Why does this crash?"
if [ $x = 0 ]
then
echo "I am here."
fi
somefunction


Now using OSX 10.7.5 and bash here is the result:-

Code:

Last login: Fri Jul 12 18:41:45 on ttys000
AMIGA:barrywalker~> ./func.sh
AMIGA:barrywalker~> ./func.sh
I am here.
AMIGA:barrywalker~> ./func.sh
./func.sh: line 4: syntax error near unexpected token `echo'
./func.sh: line 4: `echo "Why does this crash?"'
AMIGA:barrywalker~> _


Why do the first two snippets work as predicted, (although without the braces), yet the third crashes out with the error report?
What is going on?

Can someone explain what is going on?

Many thanks…

…read more

Source: FULL ARTICLE at The UNIX and Linux Forums