domingo, 8 de mayo de 2022

Código para el robot.

 #include <16F887.h>

#DEVICE ADC=10

#FUSES HS,NOWDT,NOPROTECT,NOPUT,NOLVP,BROWNOUT

#use delay(CLOCK=20M)

#USE STANDARD_IO(A)

#USE STANDARD_IO(B)

#USE STANDARD_IO(D)


#DEFINE LCD_DB4 PIN_D4

#DEFINE LCD_DB5 PIN_D5

#DEFINE LCD_DB6 PIN_D6

#DEFINE LCD_DB7 PIN_D7

#DEFINE LCD_RS  PIN_D2

#DEFINE LCD_E   PIN_D3



#DEFINE USE_SERVO_1

#DEFINE USE_SERVO_2

#DEFINE USE_SERVO_3

#DEFINE SERVO_1 PIN_B5

#DEFINE SERVO_2 PIN_B6

#DEFINE SERVO_3 PIN_B7

#INCLUDE <servo_st.c>

#INCLUDE <map_function.c>

#INCLUDE <math.h>

#INCLUDE <LCD_16X2.c>


LONG VALOR_ADC=0;


FLOAT POSX=0;

FLOAT POSY=0;

FLOAT POSZ=0;

INT POSX_T=0;

INT POSY_T=0;

INT POSZ_T=0;

FLOAT R=0;

FLOAT H=0;

FLOAT THETA2=0;

FLOAT ALPHA=0;

FLOAT BETA=0;


FLOAT L1=14.0;

FLOAT L2=13.95;


INT ANGULO=0;

INT ANGULO2=0;

INT ANGULO3=0;


INT GRAB1[3]={0,0,0};

INT GRAB2[3]={0,0,0};

INT GRAB3[3]={0,0,0};

INT GRAB4[3]={0,0,0};


INT SELECTOR=0;

INT CONTADOR=0;



VOID MANUAL1(){

   DELAY_US(20);

   SET_ADC_CHANNEL(0);                 //ELEGIR CANAL ANALOGO 1

   DELAY_US(20);

   VALOR_ADC=READ_ADC();               //LEER VALOR ANÁLOGO

   ANGULO=MAP(VALOR_ADC,0,1023,6,178); //MAPEAR VALOR 0V=0° 5V= 180°

   SERVO_1_WRITE(ANGULO);              //ESCRIBIR EL ANGULO

   

   SET_ADC_CHANNEL(1);

   DELAY_US(20);

   VALOR_ADC=READ_ADC();

   ANGULO2=MAP(VALOR_ADC,0,1023,20,160);

   SERVO_2_WRITE(ANGULO2);

   

   SET_ADC_CHANNEL(2);

   DELAY_US(20);

   VALOR_ADC=READ_ADC();

   ANGULO3=MAP(VALOR_ADC,0,1023,25,175);

   SERVO_3_WRITE(ANGULO3);

   

    IF(INPUT(PIN_A4)==1){

      OUTPUT_HIGH(PIN_B4);

   }

   ELSE{

      OUTPUT_LOW(PIN_B4);

   }

   

  

     

   

   lcd_gotoxy(1,1);

   printf(lcd_putc,"bas=%3u",ANGULO);

   

   lcd_gotoxy(9,1);

   printf(lcd_putc,"bra=%3u",ANGULO2);

   

   lcd_gotoxy(1,2);

   printf(lcd_putc,"br2=%3u",ANGULO3);

   

   

}


VOID IK(){

   DELAY_US(20);

   SET_ADC_CHANNEL(0);                 //ELEGIR CANAL ANALOGO 1

   DELAY_US(20);

   VALOR_ADC=READ_ADC();               //LEER VALOR ANÁLOGO

   POSX=MAP(VALOR_ADC,0,1023,-10,10); //MAPEAR VALOR 0V=0° 5V= 180°

                    

   

   SET_ADC_CHANNEL(1);

   DELAY_US(20);

   VALOR_ADC=READ_ADC();

   POSY=MAP(VALOR_ADC,0,1023,10,20);

      

   SET_ADC_CHANNEL(2);

   DELAY_US(20);

   VALOR_ADC=READ_ADC();

   POSZ=MAP(VALOR_ADC,0,1023,0,10);

   

   POSX_T=POSX;

   POSY_T=POSY;

   POSZ_T=POSZ;

   

   R=SQRT(POSX*POSX+POSY*POSY);

   H=SQRT(R*R+POSZ*POSZ);

   THETA2=ATAN(POSZ/R)*180.0/PI;

   ALPHA=ACOS((-L2*L2+L1*L1+H*H)/(2*L1*H))*180.0/PI;

   BETA=ACOS((L2*L2+L1*L1-H*H)/(2*L1*L2))*180.0/PI;

      

   ANGULO=(ATAN2(POSY,POSX))*180.0/PI+8.0;

   ANGULO2=150-ALPHA-THETA2;

   ANGULO3=180-BETA;

      

   SERVO_1_WRITE(ANGULO);

   SERVO_2_WRITE(ANGULO2);

   SERVO_3_WRITE(ANGULO3);

   

   IF(INPUT(PIN_A4)==1){

      OUTPUT_HIGH(PIN_B4);

   }

   ELSE{

      OUTPUT_LOW(PIN_B4);

   }

   

   lcd_gotoxy(1,1);

   printf(lcd_putc,"POX=%3D",POSX_T);

   

   lcd_gotoxy(9,1);

   printf(lcd_putc,"POY=%3D",POSY_T);

   

   lcd_gotoxy(1,2);

   printf(lcd_putc,"POZ=%3D",POSZ_T);

}


VOID GRABAR(){


   DELAY_US(20);

   SET_ADC_CHANNEL(0);                 //ELEGIR CANAL ANALOGO 1

   DELAY_US(20);

   VALOR_ADC=READ_ADC();               //LEER VALOR ANÁLOGO

   ANGULO=MAP(VALOR_ADC,0,1023,0,180); //MAPEAR VALOR 0V=0° 5V= 180°

   SERVO_1_WRITE(ANGULO);              //ESCRIBIR EL ANGULO

   

   SET_ADC_CHANNEL(1);

   DELAY_US(20);

   VALOR_ADC=READ_ADC();

   ANGULO2=MAP(VALOR_ADC,0,1023,0,180);

   SERVO_2_WRITE(ANGULO2);

   

   SET_ADC_CHANNEL(2);

   DELAY_US(20);

   VALOR_ADC=READ_ADC();

   ANGULO3=MAP(VALOR_ADC,0,1023,0,180);

   SERVO_3_WRITE(ANGULO3);

   

    IF(INPUT(PIN_A4)==1){

      OUTPUT_HIGH(PIN_B4);

   }

   ELSE{

      OUTPUT_LOW(PIN_B4);

   }

      

   

   

   IF(INPUT(PIN_A5)==1){

      WHILE(INPUT(PIN_A5)==1){

         DELAY_MS(10);

         GRAB1[CONTADOR]=ANGULO;

         GRAB2[CONTADOR]=ANGULO2;

         GRAB3[CONTADOR]=ANGULO3;

         GRAB4[CONTADOR]=INPUT(PIN_A4);

         LCD_GOTOXY(1,1);

         LCD_PUTC("GRABANDO");

         CONTADOR++;

         DELAY_MS(500);

         IF(CONTADOR>2){

            CONTADOR=0;

         

      }

   }

}

}


VOID REPRODUCIR(){

  

   

   SERVO_1_WRITE(GRAB1[0]); 

   SERVO_2_WRITE(GRAB2[0]);

   SERVO_3_WRITE(GRAB3[0]);

   DELAY_MS(1500);

  /*

   DELAY_MS(1500);

   OUTPUT_BIT(PIN_B4,GRAB4[0]);

   DELAY_MS(500);

   */

   LCD_GOTOXY(1,1);

   LCD_PUTC("1");

 

   

   SERVO_1_WRITE(GRAB1[1]); 

   SERVO_2_WRITE(GRAB2[1]);

   SERVO_3_WRITE(GRAB3[1]);

   DELAY_MS(1500);

   /*

   DELAY_MS(1500);

   OUTPUT_BIT(PIN_B4,GRAB4[1]);

   DELAY_MS(500);

   */

   LCD_GOTOXY(1,1);

   LCD_PUTC("2");

   

   SERVO_1_WRITE(GRAB1[2]); 

   SERVO_2_WRITE(GRAB2[2]);

   SERVO_3_WRITE(GRAB3[2]);

   DELAY_MS(1500);

   /*

   DELAY_MS(1500);

   OUTPUT_BIT(PIN_B4,GRAB4[2]);

   DELAY_MS(500);

   */

   LCD_GOTOXY(1,1);

   LCD_PUTC("3");

   

   

   

}

  


VOID MAIN(){

   

  

   SETUP_ADC_PORTS(sAN0|sAN1|sAN2);

   SETUP_ADC(ADC_CLOCK_INTERNAL); 

   SERVO_INIT();

   LCD_INIT();

   OUTPUT_B(0x00);

   SELECTOR=0;

   

   WHILE(TRUE){

   

   

   

   IF(INPUT(PIN_A3)==1){

      WHILE(INPUT(PIN_A3)==1){

         DELAY_MS(10);

         SELECTOR++;

         DELAY_MS(500);

         IF(SELECTOR>3){

            SELECTOR=0;

         }

      }

   }

   

   SWITCH(SELECTOR){

      CASE 0:

      MANUAL1();

      BREAK;

      

      CASE 1:

      IK();

      BREAK;

      

      CASE 2:

      LCD_CLEAR();

      GRABAR();

      BREAK;

      

      CASE 3:

      LCD_CLEAR();

      REPRODUCIR();

      BREAK;

     

   }

   }

}

lunes, 7 de octubre de 2019

En el año de 1944 se llevó a cabo una de las operaciones militares más exitosas de la Segunda Guerra Mundial: la operación Fortitude. Esta operación de contra información fue organizada por los aliados con el fin de hacer creer al ejército alemán sobre el lugar y la fecha de un supuesto desembarco, para lo cual emplearon el uso de maquetas que simulaban la presencia del ejército anglo-americano, técnicos que compartían “información” que podía ser interceptada por el ejército enemigo, tanques y embarcaciones inflables. La operación fue un éxito, las mejores unidades del ejército alemán estaban en el otro extremo de Alemania, mientras que la guerra ocurría en Normandía.

La operación Fortitude es un ejemplo de lo poderoso que pueden llegar a ser los rumores, en este caso, el ejército aliado se vio beneficiado de un rumor que inició él mismo para ganar una de las batallas decisivas de la Segunda Guerra Mundial. Al mismo tiempo, nos ayuda a ver el rumor no como algo que potencialmente puede perjudicarnos, si no también, beneficiarnos.

El poder del rumor está en su potencial manipulador y ha sido usado de forma regular con fines políticos y comerciales, sin embargo, no hay que confundir el rumor con el chisme, aunque el primero surge a menudo del último, el chisme es verdadero mientras que el rumor queda en el aire, no se sabe si es verdad o no. Es por esta confusión que el rumor tiene una connotación negativa, aunque se le debería considerar como una herramienta de carácter social y lingüístico (tanto como lo es la buena dicción y la buena postura), y así como un buen rumor puede ser beneficioso para nuestra imagen y las ideas que tratamos de expresar, un mal rumor puede convertirse en un gran obstáculo para alcanzar nuestros objetivos, tal como ocurrió en 1938, cuando Orson Welles transmitió una adaptación radiofónico de La Guerra de los Mundos, que fue tomada por muchos como el hecho de que en verdad estábamos siendo atacados por extraterrestres. El resultado: millones de estadounidenses en pánico por la supuesta llegada de extraterrestres.

jueves, 1 de febrero de 2018

THE ANATOMY MURDERS OF BURKE AND HARE (1828)

LOCATION: Edinburgh

PERPETRATORS: William Burke and William Hare

MOTIVATION: Murder

BACKGROUND: Ober the course of a ten-month period, from February to November 1828, William Burke and William Hare murdered 16 people in Edinburgh, Scotland, in a case that would become known as the Anatomy Murders.
Up until 1832, when the law was changed, partly in response to the Barke and Hare murders, there were few ways for doctors to obtain human bodies for the purpose of medical research. At the same time, a rapid rise in the population of Britain was occurring, which meant that more doctors were needed and medical schools were expanding.
Resurrectionists were certainly at work in Edinburgh during the 1820's and it was not unusual for the relatives of a recently deceased person to mount vigil over their grave to prevent the body being stolen.
On November 29, 1827, an elderly tenant with no known relatives died of natural causes in the lodging house run but Hare and one way for Hare to recoup the money was to sell the body to the medical school.
The next opportunity to make easy money presented itself to Burke and Hare the following February when another of Hare's lodgers fell ill, when the man began to recover, Burke and Hare took matter into their own hands, plying him with whiskey until he became unconscious, at which point one of them smothered him with a pillow while the other lay across his chest.
Once they had crossed the line into murder, they began to kill regularly, mostly targeting people who had come to stay in the lodging house or those they met elsewhere.
The murderers went with the porter so that they could collect the money they were owed from Knox´s assistants. Over the course of the spring and summer, they sold a succession of bodies to Knox in this way, with no questions being asked.
In October they murdered 18-year-old James Wilson, who suffered from some form of mental disability and was a well-known character on the streets.
The murder of James Wilson should have raised suspicions about Burke and Hare, but it was actually their next murder, the sixteenth, that finally led to their arrest.
The trial began on Christmas Eve  and considered the Docherty case first, with both William and Margaret Hare taking the stand to testify against Burke and MacDougal. Burke was sentenced to death and on January 28, 1829, he was hanged at a public execution in Edinburgh, the other three defendants were released from custody and forced to leave the city.


OUTCOME: A law passed in 1832, which allowed medical school to acquire bodies for anatomical research by legal means.
THE OUTLAW JESSE JAMES (1860-1882)

LOCATION: Western Missouri

PERPETRATORS: Jesse and Frank James, the Younger brothers

MOTIVATION: Murder and robbery

BACKGROUND: 
In May 1864, the 16-year-old Jesse James joined his older brother Frank in a band of Confederate guerilla fighters.
Image result for JESSE JAMESThe guerilla was in Missouri was a brutal and dirty affair in which neither side observed the usual rules of war and the murder of civilians and unarmed soldier was a common occurrence.
In 1850, when Jesse was three years old, his father went to California to find his fortune in the Gold Rush but contracted cholera shortly after arriving there and died, leaving his family in serious financial trouble.
During this period, many migrants were settling in Missouri, some of whom, like James family, came from the southern states of America and brought their slaves with them. Others came from the north and from Europe, principally Ireland and Germany, and of these arrivals were opposed to the institution of slavery.
After the civil war started in 1861, Missouri remained in the Union, but many people in the sate supported the secessionist Confederacy in the South, including the James family, who, at the start of the war, owned six slaves.
By the summer of 1864, Frank and Jesse had joined the bushwhacker band led by William T. Anderson, who had a murderous reputation and was known as Bloody Bill.
Jesse James was shot in the chest during an encounter with Union soldiers in May 1865 and spent time convalescing under the care of his cousin Zee Mimms, who he would later marry.
Jesse James appears to have rejoined his former comrades at some pint during the summer of 1866, but did not begin to emerge as a prominent figure until December 7, 1869, when he and his brother robbed the bank in Gallatin, Missouri.
One newspaperman who would become closely associated with the James brothers was John Newman Edwards and began with what we might now call a publicity campaign in their favor.
 In 1879 Jesse recruited a new gang, including the brothers Charley and Bob Ford, and set up on a crime spree.
In December 1881, Jesse and Zee James rented a house in the town of St. Joseph. It was here that, on April 3 1882, he was killed at the age of 34, shot in the back of the head by Bob Ford, who had apparently agreed with his brother Charley to kill Jesse so they could collect the reward.


OUTCOME: The civil war finally ended for James when he was shot dead by Bob Ford.
THE ASSASSINATION OF ABRAHAM LINCOLN (1865)

LOCATION: Washington, D.C.

PERPETRATORs: John Wilkes Booth and his fellow conspirators.

MOTIVATION: Assassination

BACKGROUND
:
 
On Good Friday, April 14, President Abraham Lincoln was assassinated by the well-known actor John Wilkes Booth shortly after 10 o´ clock in the evening as he was attending a performance in Washington.
Lincoln was attended by two doctors in the audience that night. He had not been killed instantly by the gunshot, but the doctors quickly determined from the nature of his head wound that he would not survive.
Image result for john wilkes booth bodyThe investigation into the assassination of Lincoln focused on known associates of Booth and resulted in numerous arrests, although most of the people held were later released without charge. But the police also discovered a connection to the Washington boarding house run by Mary Surrat, who was arrested there along with Lewis Powell.
The boarding house had been used by the conspirators as a meeting place to discuss what had originally been a plan to abduct Lincoln with the intentions of exchanging it him for Confederate prisoners.
By the time of those arrests Booth was hiding out in an are of dense forest and wetland in southern Maryland known as Zekiah Swamp.
In total eight people were charged with being involved in the conspiracy to assassinate President Lincoln. President Andrew Johnson, who had been sworn into office within hours of Lincoln´s death, ordered that the trial of the conspirators be heard by a military tribunal.
Even if it is not possible to say for certain whether Booth was acting on orders from the Confederate government, he was the driving force behind the conspiracy as it developed from a plot to kidnap a Lincoln into one of assassination. His motivation appears to have been what he saw as an attempt by the North to destroy the culture of the South and, in particular, the institution of slavery. He came to regard Lincoln as the man responsible for this, the embodiment of all that he hated.


OUTCOME: The conspirators succeeded in killing Lincoln but not in their long-term aim of prolonging the Civil War.
DICK TURPIN: THE HIGHWAYMAN (1730)

LOCATION: England

PERPETRATORs: Turpin and his criminal associates

MOTIVATION: Murder, robbery

BACKGROUND: 
Image result for DICK TURPINThe criminal career of Dick Turpin spanned about seven or eight years, beginning in the early 1730's and ending on April 7, 1739, when he was hanged in the English city of York after being convicted of horse theft.
He would become much more famous after his death as a consequence of the publication of numerous accounts of his life, beginning within days of his execution when Richard Bayes, elaborating some details and inventing others to present Turpin as a heroic figure, in the process establishing the character of the dashing highwayman.
Turpin began as a petty criminal in the English county of Essex before graduating to more serious crimes, including burglary, armed robbery, and murder, with little to suggest that he bore any resemblance to a later depictions of him as being a "knight of the road".
He followed his father as a butcher and it would appear that this line of business first brought him into contact with the criminal gang he would later join.
Over the course of 1734, the gang became more ambitious staging raids against isolated farms in Essex and in other places  around London.
A reward of £50 was issued for information, leading to the arrest of three members of the gang.
By the summer of 1735, all of them, with the exception of Turpin and one other, Thomas Rowden, had been caught, put on trial, and either executed or transported to the American colonies.
The robberies continued over the course of the following months until Rowden was arrested towards the end of 1735.
After losing his partner, Turpin disappeared from the view for more than a year, perhaps laying low to avoid arrest himself or living under an assumed name without committing any crimes that could be traced back to him. In February 1738 he remerged in the company of another man sometimes identified as the well-known highwayman Tom King and sometimes as his younger brother Matthew King.
Rather than being taken to either Essex or London to face charges of murden and highway robbery, Turpin remained in York to stand trial for horse theft. The trial occurred on March 22, 1739, at the York Assizes.
The sentence was carried out on April 7 in front of a large crowd at York racecourse. The account goes on to say that it took five minutes for him to die and then his body left hanging for several hours to make sure he was dead.


OUTCOME: The death of the highway man and the birth of a legend.
THE MURDERER OF JOHN NEWCOMER (1630)

LOCATION: Plymouth Colony

PERPETRATOR: John Billington

MOTIVATION: Murder

ANTECEDENTS: Little is known of the life of John Newcomer beyond the fact that in early September 1630 he was shot and killed.
He was a newcomer to the Plymouth Colony, the settlement established ten years previously by the group now known as the Pilgrim Fathers, arrived on board the Mayflower in December 1620.
John Billington was one of these  originals settlers and a signatory to the Mayflower Compact, the document written during the Atlantic passage setting out regulations to govern the new colony.
Billington may have sailed on the Mayflower, but he was not one of the group of religious separatists who would later become known as the Pilgrim Fathers. They were followers of the Protestant cleric Robert Brown, who, along with other Puritans did not think the Reformation had gone far enough in England so had moved to Holland in an attempt to find a place to live where they could practice their religion.
The original intention had been to settle in Virginia, where they had purchased a lease from the London Virginia Company and where an English colony had previously been established at Jamestown.
 The first winter proved to be extremely hard in the new colony. Half of the settlers died from disease and a lack of food.
After that terrible experience, the settlers held what is now called the "First Thanksgiving" after the success of the harvest in the following year.
Even before they had founded their first settlement, tensions existed between Billington and William Bradford, the leader of the separatists on board the Mayflower and the future governor of Plymouth Colony.
It is impossible to know the extent to which Billington deserved his reputation as a troublemaker; the only details we have come from Bradford´s writing and may have been a result of some unknown personal animosity between the two.
The murder of John Newcomen by Billington in the summer of 1630 provided Bradford with the opportunity he may have been looking for to take action against a man who had threatened his position as governor of the colony.
According to Bradford´s report account Billington had previously been involved in an argument with Newcomen over an unspecified subject and this disagreement, whatever its nature, led to Billington shooting Newcomen.

OUTCOME: On September 30, 1630, John Billington was hanged, becoming the first, but by no means the last, American to be executed for murder.