Feeds:
Posts
Comments

Why we still need to learn about how to create floppy disk image?
Floppy disk is only used in the old PC but we still need it for simulation in virtual machine. May be you want to collect old applications that run in old MS-DOS, learn about how old viruses work, install first generation linux, etc.. etc so you still need this image.

I will show how to create floppy image in Linux 14.04 LTS.

Step 1. Create directory in /media
Open your linux terminal, type $cd /media. Type $sudo mkdir floppy. to create the floppy directory.

————————————————————-
darklinux@darklinux:~$ cd /media
darklinux@darklinux:/media$ ls -l
total 4
drwxr-x—+ 4 root root 4096 Jan 2 15:23 darklinux
darklinux@darklinux:/media
$ sudo mkdir floppy
[sudo] password for darklinux:
darklinux@darklinux:/media$ ls -l
total 8
drwxr-x—+ 4 root root 4096 Jan 2 15:23 darklinux
drwxr-xr-x 2 root root 4096 Jan 2 15:49 floppy
darklinux@darklinux:/media$

————————————————————-

Step 2. Create floppy disk image.
Open another linux terminal or go back to home directory.
Type $ mkfs.msdos -C myfloppy.img 1440 to create the floppy image.
-myfloppy.img is the image file
-1440 is floppy size (1.44 MB)

Type $ sudo mount -o loop myfloppy.img /media/floppy/ to mount the image with the floppy directory.
Continue Reading »

Advertisements

Now let’s try to write simple code.
Open your Arduino IDE and type the codes below. I will not explain about the coding in this article yet. Just try it first.
This code will tell arduino to turn on and turn off the led light on arduino board or supply 5 volt to pin 13 every 1 second continuously.

———————————————————————————-
/* Program: Hello Word!!
   Code by: Taufan     */

const int pinLED = 13; // set pinLED as integer (number) with value13
void setup() {
pinMode(pinLED, OUTPUT); //set pin number 13 as Output.
}

void loop() {
digitalWrite(pinLED, HIGH); //supply voltage 5 volt via pin 13
delay(1000); //delay (keep turn on) for 1000 milli second (1 second).
digitalWrite(pinLED, LOW); //turn off the voltage at pin 13.
delay(1000); // keep turn off for 1 second
//repeat again.. (loop)
}
———————————————————————————-
After you type the codes, you verify it first or upload it to arduino board to run the program.
To verify the program, just click the ‘verify button’ with sign ‘‘. Verify mean, it only check if there is any error codes.
arduino_05
Continue Reading »

Before we start, I will explain a bit about few terminologies that you should know first.

Since Arduino is a type of a micro-controller, so what is Micro-Controller?
Micro-controller is a small computer on single integrated circuit board containing a processor core, memory and programmable input/output peripherals. Processor is the brain that do the process for all instructions given from the programmer. Memory is the temporary place to keep all instructions before processed by the processor. And programmable input/ouput mean that we can program Arduino to do something and change it with new program in the future.

What is the benefit using Arduino?
You can program arduino to control anything. From the simple one, light on an LED light to more complicated one. You can use it to monitor the temperature, wind speed, home automation (Music, TV, Fan, Pump, Lamps, water plant), check gas leaking, motion sensor, light sensor, heart beat sensor, robot etc. etc..
The limitation from the implementation arduino is your idea.

What you should know if you want to use Arduino?
You have to know at least basic C programming language and basic function of electronics like transistor, resistor, diode, relay, AC power and DC power. Because basically arduino is only supply and receive electric DC current through its pins, digital and analog. Just simple like that.

What are the types of Arduino?
First generation of manufactured Arduino is NG (new generation). NG used the Atmega8 chip running at 16MHz, 6K memory and run at 19200 baud. The next version was Diecimila with Atmega168 chip, 16MHz, 16 kilo byte (K) memory but still still run at 19200 baud.

In 2009 Duemilanove was released with Atmega328, 32K memory and run at 57600 baud. There is a good thing in this version. The power supply can be switched from USB to DC. Finally Arduino can be stand alone.

All of the above version use 2KB bootloader and FTDI (FT232RL) chip to control the USB interface. FT232RL is royalty free driver but it is only act as USB port. You can can’t use it with keyboard, mouse, MIDI etc.

In 2010, we got Uno. Uno in Italian mean ‘One’. It’s named to mark the upcoming release of Arduino 1.0. The Uno and version 1.0 will be the reference versions or Arduino. Uno still use Atmega328 but has smaller bootloader (521bytes) mean that you get another additional 1.5K free extra flash memory for programming. It also has atmega8u2 chip to replace FT232RL which allows various type USB interface. Now it runs at 115K baud. You can upload your codes in 3 seconds.

Arduino Uno board (front side)
ArduinoUnoFront

Arduino Uno board (back side)
ArduinoUnoBack
Continue Reading »

What is method?
In programming language, method is something that you do to an object.

For example, the object is ‘door‘ and you want to apply an action ‘open‘.

In python you can write as: door.open().

door = object

open = method

( ) = argument

Argument is the place for parameters that you apply to the method.

For example, you want to open your door half only or full open then changing the color painting to blue or red.

The syntax will be:

door.open(‘half)

door.open(‘full‘)

door.color(‘blue‘)

door.color(‘red‘)
In python, you can use built-in methods or create it manually.

Let me explain more details.
Continue Reading »

If Statement is a conditional that python will check before taking a new action. If statement result is TRUE, python will process the command given otherwise it will ignore and execute the next step.

The syntax is:
if statement:
your_command

Let’s try.
—————————————————————
>>> myprogramming_language=’python’
>>> if myprogramming_language==’python’:
print “Python is my programming language”

Python is my programming language
>>>
—————————————————————

myprogramming_language=’python’ will tell python, please enter variable myprogramming_language with value python.

if myprogramming_language==’python’: will tell python, if myprogramming_language is equal with ‘python’ then execute the next line, otherwise just ignore and continue to the next step.

If it’s equal mean the condition is True.

If it’s not equal the condition is False.


Continue Reading »

Strings is one or more combination of alphabet. Python will recognize double colon(“ ”) or single colon (‘ ‘) for string declaration.

For example, to declare ‘This is a string‘ as string, you can use double colon or single colon.

——————————-
>>> “This is a string”
‘This is a string’
>>> ‘This is a string’
‘This is a string’
>>>
——————————-

Very easy. How about to write Hii… I’m python. There is one single colon in the string.

You can’t write, ‘Hi.. I’m python’ because python will confuse to set the beginning and the end of the string because single colon in (I’m) will consider as end of string content.
——————————-
>>> “I’m python”
“I’m python”
>>> ‘I’m python’
SyntaxError: invalid syntax
>>>

But, with “double colon is fine.

——————————-
>>> “I’m python”
“I’m python”
——————————-

Continue Reading »

Function is a built-in program that available in Python that we can use to simplify our programming code. Mostly every programming language provide their built-in function according to purpose why it’s created. Functions in C, python, pearl, vb, assembly will be different.

To use function in python, you have to write the function name then followed by the parameters that the function need. Parameter is the information that will be used by function to solve the problem.

Built-in Functions:
abs(), divmod(), input(), open(), staticmethod(), all(), enumerate(), int(), ord(), str(), any(), eval() isinstance(), pow(), sum(), basestring(), execfile(), issubclass(), print(), super(), bin(), file(), iter(), property(), tuple(), bool(), filter()
,len(), range(), type(), bytearray(), float(), list(), raw_input(), unichr(), callable(), format(), locals(), reduce(), unicode(), chr(), frozenset(), long(), reload(), vars(), classmethod(), getattr(), map(), repr(), xrange(), cmp(), globals(), max(), reversed(), zip(), compile(), hasattr(), memoryview(), round(), __import__(), complex(), hash(), min(), set(), apply(), delattr(), help(), next(), setattr(), buffer(), dict(), hex(), object(), slice(), coerce(), dir(), id(), oct(), sorted(), intern()

Continue Reading »