jeudi 29 décembre 2011

python -> G20

Python déjà installlé.

hello.py
print "Hello world !"

debarm:~# python hello.py
Hello world !

C++ -> G20

le compilateur G++ n'est pas installer par défaut sur la carte.

Dans la doc il faut
debarm:~# apt-get update
debarm:~# apt-get install g++

Probleme le ping vers internet ne marche pas sur la carte.
Modification du fichier /etc/resolv.conf en rajoutant en name server celui de google
nameserver 8.8.8.8

Du coup l'installation se passe avec quelques erreurs tout de même.

perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "fr_FR.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").


hello.cc
#include 

using namespace std;

int main(int argc, char *argv[]) {
cout << "Hello world !" << endl;
return 0;
}

Compilation et execution
debarm:~# g++ hello.cc -o hello
debarm:~# ./hello
Hello world !

SSH -> G20

@IP pour la fox comme sur toutes les distribs linux
/etc/network/interfaces.
Configurer par défaut en DHCP. On met l'@IP en statique.

cd /media/rootfs/etc/network/
sudo gedit interfaces

en ce qui me concerne voila la config.

auto eth0
iface eth0 inet static
address 192.168.1.30
netmask 255.255.255.0
gateway 192.168.1.1

SSH
ssh root@192.168.1.30
pass: netusg20

et normalement on à le promt
debarm:~#

Youpi.

G20 -> C -> Hello world

On peut compiler directement sur la G20 ce qui n'est pas forcément explicite sur le nouveau site de fox, mais beaucoup plus clair sur l'ancien site.

Comment faire.
#include 

int main(void) {
printf("Hello world !\n");
return 0;
}
Installer gcc, mais normalement il est déjà présent.
debarm:~# apt-get update
debarm:~# apt-get install gcc
Compiler et executer
debarm:~# gcc hello.c -o hello
debarm:~# ./hello
Hello world !
En ce qui me concernet j'ai 2 gcc de dispo.
gcc gcc-4.3

mercredi 28 décembre 2011

GIT + GITHUB

Créer un nouveau projet sous GITHUB

Dépôt local:

Maintenant que nous avons configurer notre premier environnement de travail local il ne nous reste plus qu'à configurer notre dépôt local. Pour cela :

#créer le dossier de travail :
mkdir nomdepots

#rentrer dans le dossier puis initialiser le git :
cd nomdepots
git init

#Créer les fichiers de notre projet (ici nos allons créer un fichier README):
echo "Ceci est un exemple de fichier README d'un dossier vide" > README

#Ajouter README dans notre dépôt
git add README

#Première sauvegarde :
git commit -m "Première sauvegarde : Ajout du fichier README"

#Ajouter le dossier "origin" au niveau de votre dépôt sous github
git remote add origin git@github.com:username/nomdepot.git

#Envoyer les modifications sur le serveur distant github
git push -u origin master


#Ajouter un fichier au projet.
git add nom-fichier
git commit -m 'commentaire'
git push

#Mettre à jour des fichiers modifiers.
git commit -a -m 'modif'
git push

# pour voir ce qui est configuré
git config
--list

# mettre à jour son repository local en fonction du remote "origin"

git pull


# voir le statut de GIT.
git status

GIT TRUC ET ASTUCE


karmic o karmic

Bon.
Mon linux est un peu trop vieux karmic 9.10.
Je dois installé GIT? comment faire.
launchpad à apparement ce qu'il faut.
https://launchpad.net/ubuntu/karmic/i386/git-core/

il faut encore les fichiers
/libdigest-sha1-perl_2.12-1_i386.deb ici
/liberror-perl ici

la recherche avec le mot clef launchpad ca marche bien. domage qu'il n'y est pas moyen de mettre dans le sourcelist launchpad pour les versions un peu datées!!

J'ai l'impression que c'est sans fin. Je vais changer mon sourcelist et remplacer karmic par lucid..

Je sens que je vais tester mint bientôt.


Super. J'ai jusqu'à avril 2013 maintenant. youhou..

macro oppenoffice code


REM ***** BASIC *****

Sub Main

End Sub


sub code
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "CharBackgroundExt"
args1(0).Value = false

dispatcher.executeDispatch(document, ".uno:CharBackgroundExt", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Bold"
args2(0).Value = true

dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args2())

rem ----------------------------------------------------------------------
dim args3(2) as new com.sun.star.beans.PropertyValue
args3(0).Name = "FontHeight.Height"
args3(0).Value = 10
args3(1).Name = "FontHeight.Prop"
args3(1).Value = 100
args3(2).Name = "FontHeight.Diff"
args3(2).Value = 0

dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args3())

rem ----------------------------------------------------------------------
dim args4(4) as new com.sun.star.beans.PropertyValue
args4(0).Name = "CharFontName.StyleName"
args4(0).Value = ""
args4(1).Name = "CharFontName.Pitch"
args4(1).Value = 1
args4(2).Name = "CharFontName.CharSet"
args4(2).Value = -1
args4(3).Name = "CharFontName.Family"
args4(3).Value = 0
args4(4).Name = "CharFontName.FamilyName"
args4(4).Value = "Courier New"

dispatcher.executeDispatch(document, ".uno:CharFontName", "", 0, args4())


end sub

lego motor

    The roster

    Electric Technic Motor 9V

    Lugnet Partsref 2838c01, Peeron 2838c01, Lego 74569

    The older 9V Technic motor (1990). Ungeared, it has a high rotation speed and low torque, so for most applications it requires an external gear reduction.

    Electric Technic Micromotor

    Lugnet Partsref 2986, Peeron 2986, Lego 70823

    Appeared in 1993, this small, light weight motor turns slowly and offer low torque - but respectable torque for its size. Must be used generally with pulley, top andbase, but other motion transmissions are possible (see examples by Brian Sadowsky, with a 16t gear/clutch or a pin joiner)

    Electric Technic Mini-Motor 9v

    Lugnet Partsref 71427c01, Peeron 71427c01, Lego 71427

    Since 1997, this motor replaces 2838. Geared down and quite efficient, this is the motor of choice for most applications.

    Electric Technic Mini-Motor 9v

    Lego 43362

    In 2002, Lego replaced 71427 motor with a new type, 43362. Externally almost identical, its internal structureis very different. Performances are almost as good, and its weight is much lower.

    Electric RC Race Buggy Motor

    Peeron 5292

    Introduced in 2002, this motor appeared with 8475 RC Race Buggy. Very powerful, it also consumes a lot of energy. Not recommended for use with a RCX which can't deliver the current needed by this beast. The innermost shaft hole is geared up by a 23/17 factor. Only the outermost output is tested below.

    Electric Technic Motor 9V Geared

    Peeron 47154

    This motor was first included in 4094 Motor Moversset (2003). Provides an axle hole with friction, allowing to choose axle length without the need of an extender. Flat bottom allowing easy mounting.

    NXT motor

    This motor is specific to the NXT set (2006). Includes a rotation encoder, returning to the NXT the position of the shaft with 1° resolution. Because of the special connector of this motor (non-standard phone plug type), a cable adapter is required to drive this motor with regular 9V sources. Not recommended for use with a RCX which can't deliver the high current that this motor can consume. Slow rotation speed, minimizing the need of external gear train.

    Power Functions Medium motor

    This motor belongs to a new range of motors and control elements introduced in 2007, the Power Functions. It uses a new 4 pins 9V connector that provides permanent 9V supply to control elements as well as controlled power to the motors (compatibility with old 9V system is built in extension cords). The Medium motor has holes for studless constructions as well as 6x2 bottom plate.

    Power Functions XL motor

    Big brother of Power Functions Medium motor, it provides a lot of mechanical power. Actuated by the same core as NXT motors, it rotates slightly faster (less internal gear reduction). Mounting is done through several pin holes.

    9V Train motor

    Stefan Vorst measured performances of the 9V Train motor. The results are below.

    RC Train motor

    This motor was introduced when LEGO stopped the 9V train with metal tracks. The performances of this motor are... not so good.

    Power Functions Train motor

    As the train system unifies with Power Functions, this motor , equipped with a PF cable and connector, replaces the RC train motor. Fortunately the performances are much improved, with an efficiency and power even exceeding the old 9V train motors.

    Power Functions E-motor

    Introduced with LEGO Education Renewable Energy Add-On Set (9688), the strong point of this motor is that it can be easily back-driven and used as a generator. Its high speed may be also useful in some applications. But its efficiency is no better than PF-Medium, and delivered mechanical power is about half.

    Weight


      2838


      2986


      71427


      43362


      5292


      47154

      48g

      10g

      42g

      28g

      55g

      40g


      NXT


      PF Medium


      PF XL


      9V Train


      RC Train


      PF Train


      E-Motor

      80g

      31g

      69g

      72g

      53g

      57g

      50g

    Supposed to be equivalent to 71427, 43362 motor is 30% lighter. This is generally an advantage, except when the motor is used as a counterweight, or to balance the structure, for example in COG-shifting walkers.


    No-load characteristics

    Test conditions: motor is powered by a variable, regulated power supply. An ammeter measures current flowing through the motor, a voltmeter monitors tension across. The rotation speed is measured by a RCX equipped with a light sensor, looking at an half-white/half black cylinder.

    9 V supply


    2838


    2986


    71427


    43362


    5292


    47154

    Stalled torque

    0.85 N.cm

    1.6 N.cm

    6 N.cm

    5.5 N.cm

    12 N.cm

    6 N.cm

    Stalled current

    700 mA

    80 mA

    360 mA

    340 mA

    3.2 A

    580 mA




    9 V supply


    NXT


    PF Medium


    PF XL


    9V Train


    RC Train


    PF Train


    E-Motor

    Stalled torque

    50 N.cm

    11 N.cm

    40 N.cm

    2.8 N.cm

    1.7 N.cm

    3.6 N.cm *

    3.4N.cm

    Stalled current

    2 A

    850 mA

    1.8 A

    950 mA

    750 mA

    1.3 A *

    410 mA


mercredi 21 décembre 2011

step motor

le but est de controler un moteur pas à pas

Il existe différents type de moteur pas à pas.

Un dossier ici sur les moteurs pas à pas.
Un cours sur les moteurs pas à pas, un autre

D'après ce site

Quoi choisir ?

Les moteurs pas à pas est un bon choix pour nos machines. Ils ont une longue vie si on les utilise selon les spécifications du constructeur. Ils appartiennent à trois catégories :

1. Unipolaires; 5 ou 6 fils, les moteurs unipolaires purs sont à 5 fils et peuvent être utilisés SEULEMENT avec des électroniques particulières

2. Bipolaires sont des moteurs à 4 fils à utiliser SEULEMENT avec des électroniques bipolaires

3. Hybrides sont des moteurs à 6 ou 8 fils qui peuvent être utilisés soit avec une électronique unipolaire (4 fils)soit avec une électronique bipolaire (6 fils). A noter que les moteurs hybrides utilisés en mode bipolaires ont quelque perte de performance spécialement les moteurs bas de gamme.



Moteur unipolaire comment ca marche et mise en place avec ULN2003

arduino unipolar motor stepper

Après avoir cru que mon moteur était mal branché il s'agissait plutôt de mon code!
J'utilisait la bibliothèque stepper, peut être un peu mal calibré. La le moteur tourne gentiment dans le sens des aiguilles d'une montre.

Commun : Noir
phase A : Rouge
phase B : blanc
Phase C : Marron
Phase D : vert

Note avec mon moteur descendre sous les 5 ms de delay n'est pas possible.

Code arduino

/* Stepper Copal
* -------------
*
* Program to drive a stepper motor coming from a 5'25 disk drive
* according to the documentation I found, this stepper: "[...] motor
* made by Copal Electronics, with 1.8 degrees per step and 96 ohms
* per winding, with center taps brought out to separate leads [...]"
* [http://www.cs.uiowa.edu/~jones/step/example.html]
*
* It is a unipolar stepper motor with 5 wires:
*
* - red: power connector, I have it at 5V and works fine
* - orange and black: coil 1
* - brown and yellow: coil 2
*
* (cleft) 2005 DojoDave for K3
* http://www.0j0.org | http://arduino.berlios.de
*
* @author: David Cuartielles
* @date: 20 Oct. 2005
*/

int motorPin1 = 8;
int motorPin2 = 9;
int motorPin3 = 10;
int motorPin4 = 11;
int delayTime = 500;

void setup() {
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
}

void loop() {
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(delayTime);
}

rooter android

Un peu galère à trouver ou à faire . Pas réussi avec les tutos cyanogenmod.com par adb mais androot est la.

shell sudo su make me root.......

installation du SDK android

installation du sdk android + eclipse

Installing the Android SDK
Download the latest version of the Android SDK
Unzip it and move it where needed
unzip Downloads/android-sdk_r14-mac_86.zip -d~/bin
Open Terminal.app (in /Applications/Utilities)
Edit ~/.profile and append
export PATH=~/bin/android-sdk_r14-mac_86/platform-tools:~/bin/android-sdk_r14-mac_86/tools:$PATH
Load new .profile
source .profile
Run Android SDK Manager
android
Install Components

Installing Eclipse
Download the latest version of Eclipse (Classic or Java Developers are probably best)
Open Terminal.app (in /Applications/Utilities)
Unzip it and move it where needed.
tar -zxvf Downloads/eclipse-java-helios-SR1-macosx-cocoa-x86_64.tar.gz
Optional: Add to PATH. Edit ~/.profile and append export PATH=[eclipse folder]:$PATH then reload source .profile.
Open Eclipse.
Go to Help » Install New Software.
Click Add.
Name: Google ADT
Location: https://dl-ssl.google.com/android/eclipse/
Install pieces that you want.
When ADT installation is complete, the latest version of eclipse and ADT will ask you to install or set location for android SDK. Set the location where you installed the SDK. Click OK.
If you did not see a prompt to install or choose location for ADT, open Preferences, go to Android. Set your SDK location. Click OK.




sources:
http://wiki.cyanogenmod.com/wiki/Howto:_Install_the_Android_SDK

mardi 20 décembre 2011

arduino to stepper

-----
Montage Arduino à base de driver à base de ULN2003A.

Une page de référence.

le montage unipolaire

Les composants U2004 darlington



Le montage bipolaire




Schéma



Les composant 75441one

Un autre piste à l'aide d'un L293D.


Nous allons réaliser un montage à base de ULN2004



ULN2004

Ca a l'air de marcher mais j'ai l'impression de ne pas avoir bien les bonnes phase du moteur!!!



cube craft


Pour se détendre pourquoi pas faire des petits cubes.



lundi 19 décembre 2011

Ardubloc ide for arduibo

1.Download ardublock-all.jar ArduBlock

2. In Arduino IDE, open menu “Arduino” -> “Preferences”

3. Find “Sketchbook location:”

  • In Mac, it’s by default “Documents/Arduino” under user’s home directory
  • In Linux, it’s by default “sketchbook” under user’s home director
4. Copy ardublock-all.jar to tools/ArduBlockTool/tool/ardublock-all.jar under “Sketchbook location”,Assume the user is “abu,”In Windows, it’s by default “Documents\Arduino” under user’s home directory

  • In Mac, /Users/abu/Documents/Arduino/tools/ArduBlockTool/tool/ardublock-all.jar
  • In Linux, /home/abu/sketchbook/tools/ArduBlockTool/tool/ardublock-all.jar
  • In Windows, C:\Users\abu\Documents\Arduino
5. Start the Arduino IDE and find ArduBlock under the Tool menu

Example of a ArduBlock Program

Programs

The drawers of ArduBlock are divided into 6 different categories.

Control

Control blocks are for program flow control

Controls

Numbers, Constants and Variables

These blocks provide access to computational data

Controls

Operators

These blocks provides operators for logical and mathematical computation

Operators

Utilities

These blocks provide access to utilities functions provided by Arduino platform

Utilities

Bricks

These blocks provide more intuitive access to electronic bricks system.

Bricks

Pin

This drawer probably needs a better name. The blocks here provide I/O access to Arduino Pins

Pins


Handling Digital Input and Output

The block below basically represent the “Hello World” of Arduino Programming mapping to the code fragments

   if (digitalRead(1) == HIGH) {     digitalWrite(2, HIGH);   } 

Untitled

Multiple events on the same pin should be support by defining multiple events on the same pin. It seems that a good visual grouping of the same pin would be a good thing and improve readability of the program.

Untitled

The OpenBlocks come with a pretty cool annotation system to add comments to block. This could be leveraged to enhance the readability of the program.

Untitled

Handling Analog Input and Output

The analog I/O handling should work the same way as the digital one.

Untitled

Doing conditional statements with Pin. The Pin 3 is identified with color in the ‘if’ statement. Maybe a label on it will work better.

Untitled

Functional Programming or Object Oriented?

Since Clojure is used as programming language to drive the ArduBlock, it seems that it pushes my design of the block language to have more functional programming favor. It may be a good thing to make program more straight forward to understand and to program. But really need to guard against the tunnel vision.

Rule Engine?

Since I am using a rule engine in a project right now, I may also be influenced by that. I see all these blocks laying out conditions to trigger actions. It may be worth a while to see if a small Reta Algorithm can be easily implemented in Arduino to handle the rules layout by the blocks. This seems to be a nature way to design a run time for this language.


Design I

The first design is of course to follow the Arduino Language Reference closely. However, the resulting block language seems to be a bit too “verbose?” Or should I say “busy” since it’s really a graphical representation of the textual program. Here is a sample of what it looks like for the equivalence of codes here.

void setup() {   pinMode(1, INPUT);   pinMode(2, OUTPUT); } void loop() {   if (digitalRead(1) == HIGH) {     digitalWrite(2, LOW);   } } 

Vpl 1

Design II

Since the block language is targeted at the beginner of Arduino and programming, most of time, we talk about “When the button on pin 1 is pushed, I want the LED on pin 2 to light up.” There is a much natural way to map this statement into an intuitive block language by building the blocks around the pin. Here is how it may look like:

Vpl 2

This language is more concise and easier to understand. The language itself should provide enough meta info to infer the setup codes. However, in order to do this, the language may need a little runtime (OS?) to be compiled along with the Sketch but it seems to be worth the effort.

The OpenBlocks codes I am playing around with the idea is available at my openblocks on github. Appreciate any feedback on this.


source:

http://blog.ardublock.com/