gita07

Member

Last active 8 months ago

  1. 8 months ago
    Sat Jun 18 01:37:17 2016
    gita07 started the conversation LED Control in swift with arduino and XCODE.

    Hello!,
    can someone help me with this code???
    i'm traying to write this in code in swift. im programming a code for a control a LED - Light via Ethernet with Xcode OS X and arduino!

    if someone have a tip, let me know!
    thank.
    the code is the following one:
    import Cocoa

    class ViewController: NSViewController {

    override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
    }

    override var representedObject: AnyObject? {
    didSet {
    // Update the view, if already loaded.
    }
    }

    @IBAction func ButtonON(sender: AnyObject) {

    // turn the LED on
    NSURL *url = [NSURL URLWithString:@"http://192.168.178.50/$1"];
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    [myWebView loadRequest:req];
    }

    @IBAction func ButtonOFF(sender: AnyObject) {

    // turn the LED off
    NSURL *url = [NSURL URLWithString:@"http://192.168.178.50/$2"];
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    [myWebView loadRequest:req];

    }
    }

  2. Sat Jun 18 01:31:23 2016
    gita07 joined the forum.