ARDUINO Y PROCESSING
1. Instalar version 1.5.1 de Processing (LA MAS NUEVA NO FUNCIONA)
2. Con Arduino IDE, subir StandardFirmdata al arduino
3. Poner este codigo en processing:
import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 13;
boolean led = false;
void setup() {
size(200, 200);
println("COM Ports");
println(Arduino.list());
println("=========");
arduino = new Arduino(this, Arduino.list()[1], 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);
arduino.pinMode(2, Arduino.INPUT);
arduino.digitalWrite(ledPin, Arduino.HIGH);
}
void draw() {
if (arduino.digitalRead(2) == Arduino.HIGH)
println("HIGH!!");
else
println("LOW!!");
}
void mousePressed()
{
if (led)
arduino.digitalWrite(ledPin, Arduino.HIGH);
else
arduino.digitalWrite(ledPin, Arduino.LOW);
led = !led;
}
----------------------------------------------------------------------------
http://www.youtube.com/watch?v=8OHs1VqIzVU
Libreria para C# y standard firmdata
http://www.acraigie.com/programming/firmatavb/default.html
http://code.google.com/p/sharpduino/
Leer archivo de texto con processing:
http://forum.processing.org/topic/import-and-read-files
http://txapuzas.blogspot.com/2009/12/txapu-cnc-hardware.html
GCODE SENDER TO ARDUINO
http://www.contraptor.org/forum/t-287260/gcode-sender-program
Smooth scrolling text en c#
1. Create a C# windows form application
2. In the Solution Explorer window, right click the project node and click Add->New Item button.
3. Select the Component Class template, rename it to MarqueeLabel.cs and click Add button
4. Replace the MarqueeLabel implementation with Fernando's codes
5. Delete the default MarqueeLabel.designer.cs file
6. Build you solution
7. In your Form designer, you will find the MarqueeLabel component in the tool box window.
8. Drag it onto your form, it will work correctly.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DeteccionPuertos
{
class MarqueeLabel : Label
{
private int CurrentPosition { get; set; }
private Timer Timer { get; set; }
public MarqueeLabel()
{
UseCompatibleTextRendering = true;
Timer = new Timer();
Timer.Interval = 25;
Timer.Tick += new EventHandler(Timer_Tick);
//Timer.Start();
}
public void Start()
{
Timer.Start();
}
public void Stop()
{
Timer.Stop();
}
void Timer_Tick(object sender, EventArgs e)
{
if (CurrentPosition > Width)
CurrentPosition = -Width;
else
CurrentPosition += 2;
Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.TranslateTransform((float)CurrentPosition, 0);
base.OnPaint(e);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (Timer != null)
Timer.Dispose();
}
Timer = null;
}
}
}
2. In the Solution Explorer window, right click the project node and click Add->New Item button.
3. Select the Component Class template, rename it to MarqueeLabel.cs and click Add button
4. Replace the MarqueeLabel implementation with Fernando's codes
5. Delete the default MarqueeLabel.designer.cs file
6. Build you solution
7. In your Form designer, you will find the MarqueeLabel component in the tool box window.
8. Drag it onto your form, it will work correctly.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DeteccionPuertos
{
class MarqueeLabel : Label
{
private int CurrentPosition { get; set; }
private Timer Timer { get; set; }
public MarqueeLabel()
{
UseCompatibleTextRendering = true;
Timer = new Timer();
Timer.Interval = 25;
Timer.Tick += new EventHandler(Timer_Tick);
//Timer.Start();
}
public void Start()
{
Timer.Start();
}
public void Stop()
{
Timer.Stop();
}
void Timer_Tick(object sender, EventArgs e)
{
if (CurrentPosition > Width)
CurrentPosition = -Width;
else
CurrentPosition += 2;
Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.TranslateTransform((float)CurrentPosition, 0);
base.OnPaint(e);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (Timer != null)
Timer.Dispose();
}
Timer = null;
}
}
}
Suscribirse a:
Comentarios (Atom)