This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Prendemos LED | |
public void sendOn(View v){ | |
HttpClient httpclient = new DefaultHttpClient(); | |
HttpPost httppost = new HttpPost("http://192.168.0.110/?L=1"); | |
//Esta es nuestra url donde mandaremos el parametro uno | |
try { | |
//List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); | |
//Codigo anterior donde tenia el error, pero esto funciona si queremos hacer post | |
//nameValuePairs.add(new BasicNameValuePair("L", "1")); | |
//httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <Ethernet.h> | |
#include <Servo.h> | |
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address | |
byte ip[] = { 192, 168, 0, 110 }; // ip in lan | |
byte gateway[] = { 192, 168, 0, 1 }; // internet access via router | |
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask | |
Server server(80); //server port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)ventanaCrear | |
{ | |
UIView *ventanaFondo = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
ventanaFondo.backgroundColor = [UIColor grayColor]; | |
[self.view addSubview:ventanaFondo]; | |
NSString *nombre = @"Creacion de un label"; | |
UILabel *lnombre = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 500, 100)]; | |
lnombre.backgroundColor = [UIColor clearColor]; | |
lnombre.font = [lnombre.font fontWithSize:25]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIView *ventanaFondo = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; //inicializamos la ventana con el | |
//nombre ventanaFondo, inicializando el frame con los tamanos del delegado | |
ventanaFondo.backgroundColor = [UIColor grayColor]; //A esta vista, contendra un color gris de fondo | |
[self.view addSubview:ventanaFondo]; //Agregamos la vista a la vista Padre (por lo general la llamamos con self.view) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *nombre = @"Creacion de un label"; //Creamos un string donde sera el nombre del contenido de nuestro label | |
UILabel *lnombre = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 500, 100)]; //Inicializamos nuestro label | |
//Nosotros le damos las medidas y la posicion con CGRectMake(margenX, margenY, tamanoX, tamanoY) | |
lnombre.backgroundColor = [UIColor clearColor]; //nuestro label tendra un fondo sin color | |
lnombre.font = [lnombre.font fontWithSize:25]; //Podemos dar el tamno de la letre e inclusive el tipo, en este caso su tamano es 25 | |
lnombre.text = [NSString stringWithFormat:@"%@", nombre]; //Le agregamos el contenido que habiamos guardado | |
[ventanaFondo addSubview:lnombre]; //Agregamos nuestro label a la vista ventanaFondo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIButton *boton = [[UIButton alloc] initWithFrame:CGRectMake(20, 100, 100, 50)]; //Creamos nuestro boton con las medidas dadas | |
[boton addTarget:self action:@selector(hola:) forControlEvents: UIControlEventTouchDown]; | |
//Al boton le agregados metodo que al pulsar mandara llamar al metodo hola | |
[boton setTitle:@"Boton" forState:UIControlStateNormal]; //El boton tendra como titulo Boton y tendra un estado normal (parecera como un label) | |
boton.backgroundColor = [UIColor blackColor]; //Le agregamos un colo negro de fondo, si no le agregamos esto nuestro boton parecera un label como ya mencionado(yo lo puse asi para diferenciarlo). | |
[boton setTitleColor: [UIColor whiteColor] forState: UIControlStateNormal]; //Le agregamos un color a nuestro titulio | |
[ventanaFondo addSubview:boton]; //Agregamos el boton a la vistaFondo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImageView *imagen = [[UIImageView alloc]initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"migesa.jpg"]]]; //Creamos una ImageView, que es una imagen y la inicializaremos con el nombre de migesa.jpg, que esta la tenemos guardada en nuestra carpeta Archivos de Xcode | |
imagen.frame = CGRectMake(10, 200, 115, 115); //Damos el tamano de nuestra vistaImagen | |
[ventanaFondo addSubview:imagen]; //Agregamos la imagen a la ventanaFondo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<string> | |
<real>, <integer> | |
<true />, or <false /> | |
<date> | |
<data> | |
<array> | |
<dict> | |
<key> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)plistVista | |
{ | |
NSString *path = [[NSBundle mainBundle] bundlePath]; //inicializamos el path | |
NSString *plistName = @"vistas.plist"; //Guardamos la direccion del archivo a leer | |
NSString *finalPath = [path stringByAppendingPathComponent:plistName]; //Leemos la direccion, | |
//guardandola en un string | |
NSDictionary *plistData = [NSDictionary dictionaryWithContentsOfFile:finalPath]; //inicializamos el diccionario | |
int cplistData = plistData.count; //Contamos las filas que contiene nuestro plis de nodo padre | |
//Essto nos servira para leer cada linea | |
for(int i = 0; i < cplistData; i++) //Inicializamos el for para su lectura |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; | |
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; | |
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; | |
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event |
OlderNewer