Skip to content

Instantly share code, notes, and snippets.

View HectorTorres's full-sized avatar

Hector Torres HectorTorres

View GitHub Profile
clc
clear all
#Definiendo variables iniciales
E=5;
R=1000;
I0=50e-9;
Vt=26e-3;
Vd=0:1e-3:5; # Vector de parametros independientes, voltaje
Id1=I0*(exp(Vd/Vt)-1); #Ecuacion del dido
@HectorTorres
HectorTorres / control-temperatura-pic.c
Created May 12, 2017 17:21
Control de temperatura con PIC PIC16F887
//Mendez Cruz Juan Daniel
//Carlos Chavez
//Control de temperatura por medio de dos sensores LM35 controlados por PIC16F887
//Rangos de Temperatura baja>10 grados C,Temperatura media[10,30] grados C
//Temperatura alta> 40 grados C, para temperatura media se acciona un ventilador
//Para Temperatura alta se acciona segundo ventilador se dispara una alarma
#include <16F887.h>
#device ADC=10 //Resolución de 10 bits para ADC
#fuses INTRC_IO,NOCPD,NOWDT,NOPUT,NOLVP,NOBROWNOUT,MCLR
<?php
// test/Unit/UserTest.php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
class Password {
protected $password = "";
// tests.cpp
#include "whattotest.cpp"
#include <gtest/gtest.h>
TEST(SquareRootTest, PositiveNos) {
ASSERT_EQ(6, squareRoot(36.0));
ASSERT_EQ(18.0, squareRoot(324.0));
ASSERT_EQ(25.4, squareRoot(645.16));
ASSERT_EQ(0, squareRoot(0.0));
}
// whattotest.cpp
#include <math.h>
double squareRoot(const double a) {
double b = sqrt(a);
if(b != b) { // nan check
return -1.0;
}else{
return sqrt(a);
}
# Se requiere definir una version minima de cmake, por compatibilidad
cmake_minimum_required(VERSION 3.22)
# Se requiere definir un nombre de proyecto.
project("Gtest")
# Buscar el paquete GTest
find_package(GTest REQUIRED)
# Vincular el archivo de salida con el de pruebas
add_executable(a.out test.cpp)
import math
def function_rectangle_type(a,b,c):
if (a == b) and (b == c):
return "Equilatero"
elif (a != b) and (b != c):
return "Escaleno"
else:
return "Isoceles"
#include <iostream>
using namespace std;
int main() {
double n1, n2, n3;
cout << "Enter three numbers, enter or space between numbers: ";
cin >> n1 >> n2 >> n3;
import math
def function_square(a):
return a*a
def function_square_root(a):
return math.sqrt(a)
def function_sum(a,b):
return a+b
import unittest
import math
def function_square(a):
return a*a
def function_square_root(a):
return math.sqrt(a)
def function_sum(a,b):